JEE容器中数据源连接的拦截连接池 [英] Intercept connection pooling of Datasource connections in JEE container

查看:91
本文介绍了JEE容器中数据源连接的拦截连接池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在JEE容器中拦截数据源的连接池机制?

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?

一些其他信息:


  • 应用程序在Wildfly上运行

  • 将Hibernate用于ORM

推荐答案

数据源配置中的选项 connection-listener 可能是解决方案。

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


connection-listener:

一个 org.jboss.jca.adapters.jdbc.spi.listener.ConnectionListener
提供了监听连接激活和
钝化的可能性,以便在连接为
之前执行操作返回到应用程序或返回到池中

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

您可以创建 org.jboss.jca的自定义实现.adapters.jdbc.spi.listener.ConnectionListener 并将其作为模块进行部署。

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.

这篇关于JEE容器中数据源连接的拦截连接池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆