简体   繁体   English

使用C3P0的多个Hibernate实例

[英]Multiple Hibernate instances using C3P0

I am facing a weird problem and it seems to be c3p0 related. 我面临一个奇怪的问题,似乎与c3p0有关。 I am starting two instances of an app in the same java vm which interact with each other. 我正在同一个Java vm中启动一个应用程序的两个实例,它们彼此交互。 After some operations "APPARENT DEADLOCK" messages appear in the log. 经过一些操作后,“ APPARENT DEADLOCK”消息出现在日志中。

I have the feeling that both app instances use the same connection pool although they use different session factory instances. 我感觉两个应用程序实例使用相同的连接池,尽管它们使用不同的会话工厂实例。

Might there be some "singleton-magic" involved in C3P0 ? C3P0可能涉及一些“单魔术”吗?

As far as I know, there are no singletons involved. 据我所知,没有涉及任何单例。 Each datasource instance is configured / instantiated / managed separately. 每个数据源实例都是分别配置/实例化/管理的。

Furthermore, using the same data source from several session factories should not cause any problems (assuming appropriate configuration, adequate number of connections, etc... but that's beside the point here). 此外,使用来自多个会话工厂的相同数据源应该不会引起任何问题(假定适当的配置,足够的连接数等),但这不重要。

Have you tried increasing the number of helper threads and setting maxAdministrativeTaskTime to a non-zero value as described here ? 您是否尝试过增加帮助程序线程的数量并将maxAdministrativeTaskTime设置为非零值(如此处所述)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM