2 Replies Latest reply on Oct 26, 2010 2:44 AM by thospfuller

    Possible bug in the event notifications {CacheStarted, CacheStopped, ViewChanged}

    thospfuller

      I am currently working on adding some functionality to the Grails Infinispan Plugin, which relies on Infinispan-4.1.0.FINAL (Radegast). This particular functionality is expressed as a mixin and will allow the developer to use a closure to receive event notifications from the cache -- for example:

       

      agentCache.onCacheEntryLoaded {
              log.info ("=====> Cache entry loaded: $it")
      }

       

      I have a basic unit test for each of the events detailed in the Listener documentation here:

       

      http://docs.jboss.org/infinispan/4.0/apidocs/org/infinispan/notifications/Listener.html

       

      however the following three annotations are not being registered (whereas all the others are):

       

      import org.infinispan.notifications.cachemanagerlistener.annotation.CacheStarted
      import org.infinispan.notifications.cachemanagerlistener.annotation.CacheStopped
      import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged

       

      Instead I'm receiving a message like the following when my test application starts:

       

      cachelistener.CacheNotifierImpl Attempted to register listener of class class com.coherentlogic.grails.infinispan.listeners.CacheStoppedListener, but no valid,public methods annotated with method-level event annotations found! Ignoring listener.

       

      and likewise my unit tests are also failing.

       

      Here's an example of one of the listener implementations which works:

       

      @Listener
      class CacheEntryCreatedListener {

         
          private def closure
         
          @CacheEntryCreated
          public void cacheEntryCreated (cacheEntryCreatedEvent) {
              closure?.call (cacheEntryCreatedEvent)
          }
      }

       

      Here's an example of one of the listener implementations which does not work:

       

      @Listener
      class CacheStoppedListener {


          private def closure
         
          @CacheStopped
          public void cacheStopped (cacheStoppedEvent) {
              closure?.call (cacheStoppedEvent)
          }
      }

       

      Does anyone have any thoughts on what I might be missing? Or perhaps this is a defect?

       

      Thanks in advance for your help,

       

      Tom