开发者

In-process Hypersonic database shared among similar web apps

I'm deploying the same Java web application multiple times in a web server. I would like to share an in-process Hypersonic database (without using sockets). The database will be updated from time-to-time.

Anyone know the best way to do this? What about shared libs (a global class-path on the server available to the web applications)? Do shared libs share static state? If so, maybe I could put a small con开发者_JS百科nection factory in the shared libs.


You can do it. The secret is to put the shared library in your app server's main /lib directory, so it gets loaded by the main classloader. Then you'll have only one copy of static classes and variables in the JVM.

Do not put the library in WEB-INF/lib. Each webapp gets its own class loader, and you'll descend into classloader hell if multiple classloaders load the same library.

Do keep in mind that this scheme is less reliable than running it out-of-process. You're more likely to get corruption, unless your data is read-only.


As far as I know, there is no way to use an in-process database from multiple processes without using a dedicated server process and inter process communication (e.g. sockets).

Shared libraries do not share their states between multiple processes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜