9 Replies Latest reply on Feb 18, 2015 7:42 AM by nadirx

    Listener callback not called

    yairogen

      I have the following code using a cluster with currently one node:

       

      GlobalConfigurationBuilder globalConfig = new GlobalConfigurationBuilder().transport().defaultTransport().clusterName("apc-cluster").addProperty("configurationFile", "jgroups-tcp.xml").build();
      DefaultCacheManager manager = new DefaultCacheManager(globalConfig);
      Configurartion config = new ConfigurationBuilder().read(manager.getDefaultCacheConfiguration).clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(1).expiration().lifespan(10000).build();
      manager.defineConfiguration(SESSION_CACHE, config);
      Cache<String, PolicySession> cache = manager.getCache(SESSION_CACHE);
      cache.addListener(new SessionCacheEventListener)
      

       

      the listener code is:

       

      @Listener (clustered = true, primaryOnly = true)
      public class SessionCacheEventListener{
      
      
        @CacheEntryRemoved
        public void sessionRemoved (sessionEntry: CacheEntryRemovedEvent[String,PolicySession]){
          System.out.println("%%%%%%%%%%%%%%%%%%%session removed: " + sessionEntry.getValue + "%%%%%%%%%%%%%%%%%%%%%%%%%%%";
        }
      }
      

       

      although I know for sure my session entry expires I don't see the system out.