@CacheListener public class ViewChangeListener { private Vector<Address> oldMembers; @ViewChanged public void handleViewChange(ViewChangedEvent event) { View newView = event.getNewView(); if (trace) log.trace("BuddyManager CacheListener - got view change with new view " + newView); Vector<Address> newMembers = newView.getMembers(); // the whole 'oldMembers' concept is only used for buddy pool announcements. MembershipChange mc = new MembershipChange(oldMembers == null ? null : new Vector<Address>(oldMembers), new Vector<Address>(newMembers)); enqueueViewChange(mc); if (oldMembers == null) oldMembers = new Vector<Address>(); oldMembers.clear(); oldMembers.addAll(newMembers); } }
@CacheStarted @CacheStopped public void printDetails(Event e) { printEvent("Cache started."); }
@CacheStopped public void cacheStopped(Event e) { if (log.isDebugEnabled()) log.debug("cache stopped: " + this); }
@NodeCreated @NodeLoaded @NodeModified @NodeRemoved @NodeVisited @NodeMoved @NodeEvicted @NodeActivated @NodePassivated public void printDetailsWithFqn(NodeEvent e) { if (e.isPre()) { printEvent("Event " + e.getType() + " on node [" + e.getFqn() + "] about to be invoked"); } else { printEvent("Event " + e.getType() + " on node [" + e.getFqn() + "] invoked"); } }
@NodeModified public void nodeModified(NodeModifiedEvent event) { handleEvictAllModification(event); }
@ViewChanged public void printNewView(ViewChangedEvent e) { printEvent("View change: " + e.getNewView()); }
@NodeCreated public void nodeCreated(NodeCreatedEvent event) { if(logger.isDebugEnabled()) { logger.debug("following node created " + event.getFqn().toString()); } }
/** * Cache started, check whether the node is the coordinator and set the singleton store cache loader's active * status. */ @CacheStarted public void cacheStarted(Event e) { localAddress = cache.getLocalAddress(); active = cache.getRPCManager().isCoordinator(); if (log.isDebugEnabled()) log.debug("cache started: " + this); }
@NodeInvalidated public void nodeInvalidated(NodeInvalidatedEvent event) { handleEvictAllInvalidation(event); }
/** * Tests if a class is properly annotated as a CacheListener and returns whether callbacks on this class should be invoked * synchronously or asynchronously. * * @param listenerClass class to inspect * @return true if callbacks on this class should use the syncProcessor; false if it should use the asyncProcessor. */ private static boolean testListenerClassValidity(Class<?> listenerClass) { CacheListener cl = listenerClass.getAnnotation(CacheListener.class); if (cl == null) throw new IncorrectCacheListenerException("Cache listener class MUST be annotated with org.jboss.cache.notifications.annotation.CacheListener"); if (!Modifier.isPublic(listenerClass.getModifiers())) throw new IncorrectCacheListenerException("Cache listener class MUST be public!"); return cl.sync(); }
@CacheListener public class CollectionRegionImpl extends TransactionalDataRegionAdapter implements CollectionRegion {
@NodeModified public void nodeModified(NodeModifiedEvent nodeModifiedEvent) { if(nodeModifiedEvent.isOriginLocal()) { return ; } final Fqn fqn = nodeModifiedEvent.getFqn(); if (!nodeModifiedEvent.isOriginLocal() && clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) { clusteredlogger.logDebug("sipStack " + clusteredSipStack + " Node modified : " + fqn + " " + nodeModifiedEvent.getData()); } }
@ViewChanged public void viewChanged(ViewChangedEvent event) { synchronized (currentView) { List view = event.getNewView().getMembers(); if (view != null) { currentView.addAll(view); establishInternalNodes(); } } }
@NodeCreated public void nodeCreated(NodeCreatedEvent nodeCreatedEvent) { if(nodeCreatedEvent.isOriginLocal()) { return ; } final Fqn fqn = nodeCreatedEvent.getFqn(); if (!nodeCreatedEvent.isOriginLocal() && clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) { clusteredlogger.logDebug("sipStack " + clusteredSipStack + " Node created : " + fqn); } }
@CacheStopped public void cacheStopped(CacheStoppedEvent cacheStoppedEvent) { if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_INFO)) { clusteredlogger.logInfo( "Mobicents Cache stopped, status: " + cacheStoppedEvent.getCache().getCacheStatus() + ", Mode: " + cacheStoppedEvent.getCache().getConfiguration().getCacheModeString()); } }
@CacheStarted public void cacheStarted(CacheStartedEvent cacheStartedEvent) { if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_INFO)) { clusteredlogger.logInfo( "Mobicents Cache started, status: " + cacheStartedEvent.getCache().getCacheStatus() + ", Mode: " + cacheStartedEvent.getCache().getConfiguration().getCacheModeString()); } }
@CacheListener public class EntityRegionImpl extends TransactionalDataRegionAdapter implements EntityRegion {
@ViewChanged public void viewChange(org.jboss.cache.notifications.event.ViewChangedEvent viewChangedEvent) { if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_DEBUG)) { clusteredlogger.logDebug("sipStack " + clusteredSipStack + " View changed : " + viewChangedEvent.getNewView().getVid()); } }
@CacheListener public class SingletonStoreListener
@org.jboss.cache.notifications.annotation.CacheListener public class SipPassivationListener extends CacheListenerBase