[infinispan-issues] [JBoss JIRA] (ISPN-4973) DataRehashed an CacheEntryInvalidated events are not fired on cache

Vitalii Chepeliuk (JIRA) issues at jboss.org
Wed Nov 12 09:25:29 EST 2014


     [ https://issues.jboss.org/browse/ISPN-4973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vitalii Chepeliuk updated ISPN-4973:
------------------------------------
    Assignee: William Burns


> DataRehashed an CacheEntryInvalidated events are not fired on cache
> -------------------------------------------------------------------
>
>                 Key: ISPN-4973
>                 URL: https://issues.jboss.org/browse/ISPN-4973
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 7.0.0.CR1, 7.0.0.CR2, 7.0.0.Final
>            Reporter: Vitalii Chepeliuk
>            Assignee: William Burns
>
> Two async listeners created  {InvalidationListener, DistributionListener} and check if async events are fired on cache 
> * InvalidationListener
> {code}
> /**
>  * Custom listener for handling notification events.
>  */
> @Listener(sync=false)
> public class InvalidationListener {
>    public AtomicInteger keyId = new AtomicInteger();
>    public String nodeName;
>    public Thread threadRunningNotif;
>    public boolean isInvalidated = false;
>    public InvalidationListener(final String nodeName) {
>       this.nodeName = nodeName;
>    }
>    /**
>     * Handles the entry created event.
>     * @param event
>     */
>    @CacheEntryCreated
>    public void handleCreationAndModification(Event event) {
>       if(event.isPre()) {
>          threadRunningNotif = Thread.currentThread();
>          keyId.getAndIncrement();
>       }
>    }
>    /**
>     * Handles the entry invalidated event.
>     * @param event
>     */
>    @CacheEntryInvalidated
>    public void handleInvalidation(CacheEntryInvalidatedEvent event) {
>       if (event.isPre()) {
>          System.out.println("Data is invalidated.");
>          isInvalidated = true;
>          threadRunningNotif = Thread.currentThread();
>          keyId.getAndIncrement();
>       }
>    }
> {code}
> * DistributionListener
> {code}
> /**
>  * Custom listener for verifying all notificaitions.
>  */
> @Listener(sync=false)
> public class DistributionListener {
>    public AtomicInteger keyId = new AtomicInteger();
>    public String nodeName;
>    public Thread topologyThreadRunningNotif = null;
>    public Thread threadRunningNotif;
>    public boolean isRehashed= false;
>    public boolean isTopologyChanged = false;
>    public DistributionListener(final String nodeName) {
>       this.nodeName = nodeName;
>    }
>    /**
>     * Handling data creation event.
>     * @param event
>     */
>    @CacheEntryCreated
>    public void handleCreationAndModification(Event event) {
>       if(event.isPre()) {
>          threadRunningNotif = Thread.currentThread();
>          keyId.getAndIncrement();
>       }
>    }
>    /**
>     * Handles data rehashed event.
>     * @param evn
>     */
>    @DataRehashed
>    public void handleDataRehash(Event evn) {
>       if(evn.isPre()) {
>          System.out.println("Data Rehashed on " + nodeName);
>          isRehashed = true;
>          threadRunningNotif = Thread.currentThread();
>       }
>    }
>    /**
>     * Handles cluster topology changed event.
>     * @param event
>     */
>    @TopologyChanged
>    public void handleTopologyChange(TopologyChangedEvent event) {
>       if(!event.isPre()) {
>          System.out.println("Topology changed." + nodeName);
>          isTopologyChanged = true;
>          topologyThreadRunningNotif = Thread.currentThread();
>       }
>    }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.8#6338)


More information about the infinispan-issues mailing list