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

Duplicate QueryCache listeners #13402

neilstevenson opened this issue Jul 4, 2018 · 1 comment

Duplicate QueryCache listeners #13402

neilstevenson opened this issue Jul 4, 2018 · 1 comment


Copy link

@neilstevenson neilstevenson commented Jul 4, 2018

In AbstractInternalQueryCache the private method getQueryCacheConfig() is called in multiple places.

This in turn calls
NodeQueryCacheConfigurator public method getOrCreateConfiguration(mapName,cacheName,cacheId)

And this calls AbstractQueryCacheConfigurator the method setEntryListener(MapName,cacheId,config) adds the listener.

The net effect being the listener is added more than once, event handling is duplicated.

Tested on 3.10.2, on server side, but looks like the same issue client side.

@ahmetmircik ahmetmircik added this to the 3.10.3 milestone Jul 5, 2018
@ahmetmircik ahmetmircik self-assigned this Jul 5, 2018
Copy link
Contributor Author

@neilstevenson neilstevenson commented Jul 5, 2018


public class Issue13402 {

	public static void main(String[] args) throws Exception {
		EntryListenerConfig entryListenerConfig = new EntryListenerConfig();
		entryListenerConfig.setImplementation(new Issue13042Listener());
		QueryCacheConfig queryCacheConfig = new QueryCacheConfig("neilCache");
    	MapConfig mapConfig = new MapConfig("neilMap");
    	Config config = new Config();
		config.getMapConfigs().put("neilMap", mapConfig);
		HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(config);

		IMap<Integer, String> neilMap = hazelcastInstance.getMap("neilMap");
		QueryCache<Integer, String>  neilCache = neilMap.getQueryCache("neilCache");
		for (int i = 0 ; i < 2 ; i++) {
			System.out.println("'" + neilMap.getName() + "' size==" + neilMap.size());
			System.out.println("'" + neilMap.getName() + "' cache size==" + neilCache.size());
			neilMap.set(i, "test");


	static class Issue13042Listener implements EntryAddedListener<Integer, String> {
		public void entryAdded(EntryEvent<Integer, String> event) {
			System.out.println(this.getClass().getSimpleName() + "@" + System.identityHashCode(this) 
				+ "," + event.getClass().getName() + "@" + System.identityHashCode(event)
				+ "," + event);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.