2 Replies Latest reply: Oct 21, 2013 8:06 AM by 1028528 RSS

    com.tangosol.util.ServiceListener not working

    1028528

      Guys,

       

      I am trying to understand how  CacheService.addServiceListener(ServiceListener listener) works, but can't quite get this working.  Any ideas/help is much appreciated.

       

       

      Here is the code in my Storage Enabled Node:

      {code}

      public class CoherenceServer {

      public static void main(String[] args) throws InterruptedException {
        DefaultCacheServer.start();
        Thread.sleep(60000);
        NamedCache cache = CacheFactory.getCache("TEST");
        CacheService cacheService = cache.getCacheService();
        cacheService.shutdown();
        while(true);
      }

      {code}

       

      Here is the code in my Storage Disabled Node:

      {code}

      public class CoherenceStorageDisabled {

      public static void main(String[] args) throws InterruptedException {
        DefaultCacheServer.start();
        NamedCache cache = CacheFactory.getCache("TEST");
        CacheService cacheService = cache.getCacheService();
           cacheService.addServiceListener(new  ServiceListener() {
           
            @Override
            public void serviceStopping(ServiceEvent arg0) {
            System.out.println("In in stopping " );   
            }
           
            @Override
            public void serviceStopped(ServiceEvent arg0) {
             System.out.println("In stopped " );      
            }
           
            @Override
            public void serviceStarting(ServiceEvent arg0) {
             System.out.println("In starting " );      
            }
           
            @Override
            public void serviceStarted(ServiceEvent arg0) {
             System.out.println("In started " );   
            }
           });  while(true);
      }
      }

      {code}

       

      Output in CoherenceStorageDisabled

        ....

      .....

      2013-10-18 14:53:12.880/55.054 Oracle Coherence GE 3.7.1.6 <D5> (thread=Cluster, member=2): Member 1 left service ContractsDistributedCache with senior member 2

       

      2013-10-18 14:53:12.880/55.054 Oracle Coherence GE 3.7.1.6 <D6> (thread=DistributedCache:ContractsDistributedCache, member=2): Service ContractsDistributedCache: sending ServiceConfig ConfigSync to all

       

       

      But serviceStopped() or serviceStopping event is never triggered..  Wonder why?

       

       

      Thanks

      D