使用 Hibernate 和 C3P0 的分布式 Web 模块的连接池
我有一个与数据库通信的 Web 服务(模型层
)。该模块负责保存和检索数据以及管理事务。也有很多BL定义了她。其他隔离的 Web 模块使用此服务来保存和检索其所需的数据。
现在模型层正在成为瓶颈。我需要改变架构。
我想将 Hibernate Entity 类和 BL 移动到它们受尊敬的 Web 模块。因此每个 Web 模块将与同一个数据库通信。但我不希望在每个模块上维护分布式连接池和事务。
我知道应该有一种方法可以为所有分布式 Web 模块使用单个连接池。但我需要专业人士的意见我该怎么做。
我不想使用 Spring
框架,该框架已被组织拒绝提供解决方案。
现在我正在尝试通过在 LDAP 上保存连接的序列化对象来找到解决方案,并且所有模块都将使用该连接池。现在我正在挠头,想知道我是否走在正确的方向上。
请引导我走上正确的道路。如果春天是唯一的选择,那么也请告诉我。我会尽力说服我的公司。
I have a Web Service (model-layer
) which communicates with Database. This module is responsible of saving and retrieving the data and managing the transaction. Also many BL are defined her. The other isolated web modules use this service to save and retrieve their required data.
Right now the model-layer
is becoming bottle neck. I need to change the architecture.
I want to move the Hibernate Entity classes and BL to their respected web modules. So each web module will communicate to same Database. But I do not want a distributed connection pool and transaction maintained on each module.
I know that there should be a way to use a Single Connection Pool for all the distributed web modules. But I need a professional opinion that how should I do that.
I do not want to use the Spring
framework, which is already been denied solution by the organization.
Right now I am trying find the solution by saving the serialized object of connection on LDAP and all the modules will use that connection pool. And right now I am scratching my head wondering if I am going in the right direction.
Please guide me to correct path. If spring is the only option then please advise me that as well. I will try to convince my company.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我已经找到答案了。
我在单个 JBoss 服务器上使用了共享数据源
(*-ds.xml)
。数据源文件如下
此 DS 可用于在不同位置运行的所有 JBoss 服务器。
需要确保
false
将使 DS 公开可用,因此您需要自己进行安全握手。I guess I have found the Answer.
I have used a shared DataSource
(*-ds.xml)
on a single JBoss server.Datasource file is as follows
This DS is available to all the JBoss servers running on different location.
One thing to make sure that
<use-java-context>false</use-java-context>
will make the DS publicly available so you need to do the security handshake yourself.