shillner
shillner

Reputation: 1846

Intercept connection pooling of Datasource connections in JEE container

is it possible to intercept the connection pooling mechanism of a DataSource in a JEE container?

For (un)setting some information on the connection's context I'm searching for a way to intercept the pooling mechanism so that I know when and which connection is put back into the pool.

So does anyone know a (common) way to do this?

Some additional info:

Upvotes: 0

Views: 624

Answers (1)

Federico Sierra
Federico Sierra

Reputation: 5206

The option connection-listener in datasource configuration can be the solution.

connection-listener:

An org.jboss.jca.adapters.jdbc.spi.listener.ConnectionListener that provides a possible to listen for connection activation and passivation in order to perform actions before the connection is returned to the application or returned to the pool

You can create a custom implementation of org.jboss.jca.adapters.jdbc.spi.listener.ConnectionListener and deploy it as a module to do that you want.

Upvotes: 1

Related Questions