[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
CacheManager.create() return different instances of CacheManager  XML
Forum Index -> Ehcache
Author Message
ettoregi

neo

Joined: 05/19/2014 06:17:11
Messages: 2
Offline

Hi All,

as per javadoc the method create() should pick an instance of CacheManager if it exists and create a singleton if it doesn't.

In my case, I'm running 2 applications in debug mode, where the first app calls create() and then adds a cache object into the returned CacheManager, while the second one calls the create() and then tries to read a cache with cacheManger.getCache("cacheName").

I've noticed that the 2 CacheManagers returned are different, do you have any clue why? Running 2 applications in debug mode from IntelliJ should use the same JVM so don't get the reason why this happens.

Please find below the ehcache.xml configuration.

There are 2 caches configured already and the first application adds a new one programmatically, but all three won't be seen by the second application. Of course the ones inserted in ehcache.xml will be initialised also by the second application, but the point is that I'm dealing with a different instance of CacheManager.

Many thanks in advance.
 Filename ehcache.xml [Disk] Download
 Description
 Filesize 38 Kbytes
 Downloaded:  165 time(s)

ljacomet

master

Joined: 03/06/2013 07:45:49
Messages: 79
Offline

Hi,

If I read your explanation correctly, I believe there is confusion here.
Starting two different applications will start two different JVMs (even if based on the same JVM files).
So it is expected that you do not see the changes you perform (added cache, put entry).

If I am misunderstanding you, can you clarify your setup?

Hope this helps,

Louis Jacomet
Terracotta engineer
ettoregi

neo

Joined: 05/19/2014 06:17:11
Messages: 2
Offline

Hi ljacomet,

I think that is the answer I was looking for, namely if I run the same application twice that is not started with the same JVM and that's why I come up with two different cache manager.

I know this goes beyond the scope, but how can I run two applications within the same JVM and thus being able to get hold of the same CacheManager?

Many thanks in advance.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team