0 Replies Latest reply on Aug 29, 2019 4:46 PM by gabboflabbo

    Expiration Listeners with infinispan caches


      We've run into a race condition whereby the expiration listener we have on a cache will not be called when the server is stopped, entries have technically expired, and then the server is started.   The entries are technically removed before we've had a chance to add a listener to a cache.


      Right now we've got a singleton @Startup that adds the listener.   Is there another way of guaranteeing the listener is placed before the cache is started?


      public class CacheResources
          @Resource( lookup = "java:jboss/infinispan/cache/test/nodeTimeoutEvent" )
          private Cache<string, nodetimeoutflowevent=""> nodeTimeoutEvent;
          public void init()
              nodeTimeoutEvent.addListener( new CustomListener() );



      I've tried looking up the container 'test' and possibly doing something there,  but looking up the container causes the caches to be started.  Which would be the same problem.