Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ehcache with RMI replication bug [SPR-10904] #15532

Closed
spring-issuemaster opened this issue Sep 10, 2013 · 0 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 10, 2013

Facundo Mateo opened SPR-10904 and commented

The fix for bug https://jira.springsource.org/browse/SPR-8081 has introduced a new one.
It's related to ehcache and RMI replication.
If you try to use RMICacheManagerPeerListener , spring instantiated cache manager created with EhCacheManagerFactoryBean, and spring instantiated caches created with EhCacheFactoryBean, it won't replicate caches anymore.
This issue affected us when we tried to migrate from spring 3.1.1 to spring 3.1.2 to solve the statistics enable problem.
After surfing on spring sources, I found that RMICacheManagerPeerListener tries to create the RMI port to communicate with other cache instances in
two points:
1- Ehcache manager initialization
At this point, caches has not been created... so RMICacheManagerPeerListener won't create any rmi listener port.
2- After a new cache has been added to cacheManager

In EhCacheFactoryBean.afterPropertiesSet:

.....
     rawCache = createCache();
     this.cacheManager.addCache(rawCache);
     }

   if (this.cacheEventListeners != null) {
       for (CacheEventListener listener : this.cacheEventListeners) {
            rawCache.getCacheEventNotificationService().registerListener(listener);
        }
    }

The problem is that RMICacheManagerPeerListener creates RMI ports based on the existence of net.sf.ehcache.distribution.CacheReplicator event listeners for caches.
This initialization will be executed after "this.cacheManager.addCache(rawCache)" sentences, but It won't find any CacheReplicator because the listeners
has not been added to the notifications service yet. In the previous spring version, the event listeners were added after cache creation time and before addCache call.


Affects: 3.1.2, 3.2.4

Reference URL: https://jira.springsource.org/browse/SPR-8081

Referenced from: commits a3df311, 562c323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.