开发者

Creating an application instance specific cache for Java/WebLogic Web Services

I'm new to both J2EE and WebLogic. I'd trying to determine the best way to implement a non-distributed cache (one cache per application instance) in a Java Web Services application running on WebLogic 10.3. I need to cache several different POJ开发者_运维百科O's.

There will be multiple WebLogic instances running on each server in a cluster. When reading about ServletContext and InitialContext, I was a bit confused. I believe ServletContext is instance specific, but I can only access it from a Servlet, correct? I will need to access to the cache in separate threads so I'm not sure if this is possible outside of a Servlet.

I was reading a bit about JNDI, but it seems to work at the server or cluster level and not for each WebLogic/application instance.

Can anyone provide me with a suggestion and a code example to initialize, access, and destroy a cache of Java POJO's?

Thanks!

Leon


Here is an example on how to implement a method cache with Spring and EHCache: http://opensource.atlassian.com/confluence/spring/display/DISC/Caching+the+result+of+methods+using+Spring+and+EHCache The cache will be local if configured as in the example.

I am using this method in a web service client library to cache the results of a frequently used service that has nearly no update to its data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜