Package org.infinispan.notifications.cachelistener.event

Examples of org.infinispan.notifications.cachelistener.event.EventImpl


                  }
                  try {
                     // Only run converter on events we can change and if it was keyed
                     if (!unKeyed && converter != null) {
                        if (event instanceof EventImpl) {
                           EventImpl eventImpl = (EventImpl)event;
                           eventImpl.setValue(converter.convert(eventImpl.getKey(), eventImpl.getValue(),
                                                                eventImpl.getMetadata()));
                        } else {
                           throw new IllegalArgumentException("Provided event should be EventImpl when a converter is" +
                                                                    "being used!");
                        }
                     }
View Full Code Here


      }

      private boolean shouldInvoke(Object event, boolean isLocalNodePrimaryOwner) {
         if (onlyPrimary && !isLocalNodePrimaryOwner) return false;
         if (event instanceof  EventImpl) {
            EventImpl eventImpl = (EventImpl)event;
            // Cluster listeners only get post events
            if (eventImpl.isPre() && clustered) return false;
            if (filter != null && !filter.accept(eventImpl.getKey(), eventImpl.getValue(), eventImpl.getMetadata())) return false;
         }
         return true;
      }
View Full Code Here

   public void notifyCacheEntryCreated(Object key, boolean pre, InvocationContext ctx) {
      if (!cacheEntryCreatedListeners.isEmpty()) {
         boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setPre(pre);
            e.setKey(key);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_CREATED);
            for (ListenerInvocation listener : cacheEntryCreatedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryModified(Object key, Object value, boolean pre, InvocationContext ctx) {
      if (!cacheEntryModifiedListeners.isEmpty()) {
         boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setValue(value);
            e.setPre(pre);
            e.setKey(key);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_MODIFIED);
            for (ListenerInvocation listener : cacheEntryModifiedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryRemoved(Object key, Object value, boolean pre, InvocationContext ctx) {
      if (!cacheEntryRemovedListeners.isEmpty()) {
         boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setValue(value);
            e.setPre(pre);
            e.setKey(key);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_REMOVED);
            for (ListenerInvocation listener : cacheEntryRemovedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   @Override
   public void notifyCacheEntryVisited(Object key, Object value, boolean pre, InvocationContext ctx) {
      if (!cacheEntryVisitedListeners.isEmpty()) {
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setPre(pre);
            e.setKey(key);
            e.setValue(value);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_VISITED);
            for (ListenerInvocation listener : cacheEntryVisitedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryEvicted(final Object key, Object value, final boolean pre, InvocationContext ctx) {
      if (!cacheEntryEvictedListeners.isEmpty()) {
         final boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setPre(pre);
            e.setKey(key);
            e.setValue(value);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_EVICTED);
            for (ListenerInvocation listener : cacheEntryEvictedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryInvalidated(final Object key, Object value, final boolean pre, InvocationContext ctx) {
      if (!cacheEntryInvalidatedListeners.isEmpty()) {
         final boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setPre(pre);
            e.setKey(key);
            e.setValue(value);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_INVALIDATED);
            for (ListenerInvocation listener : cacheEntryInvalidatedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryLoaded(Object key, Object value, boolean pre, InvocationContext ctx) {
      if (!cacheEntryLoadedListeners.isEmpty()) {
         boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setPre(pre);
            e.setKey(key);
            e.setValue(value);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_LOADED);
            for (ListenerInvocation listener : cacheEntryLoadedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

   public void notifyCacheEntryActivated(Object key, Object value, boolean pre, InvocationContext ctx) {
      if (!cacheEntryActivatedListeners.isEmpty()) {
         boolean originLocal = ctx.isOriginLocal();
         InvocationContext contexts = icc.suspend();
         try {
            EventImpl e = new EventImpl();
            e.setCache(cache);
            e.setOriginLocal(originLocal);
            e.setPre(pre);
            e.setKey(key);
            e.setValue(value);
            setTx(ctx, e);
            e.setType(CACHE_ENTRY_ACTIVATED);
            for (ListenerInvocation listener : cacheEntryActivatedListeners) {
               listener.invoke(e);
            }
         } finally {
            icc.resume(contexts);
View Full Code Here

TOP

Related Classes of org.infinispan.notifications.cachelistener.event.EventImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.