[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...
Manik Surtani
manik at jboss.org
Thu Jun 28 12:53:36 EDT 2007
User: msurtani
Date: 07/06/28 12:53:36
Modified: src/org/jboss/cache/loader SingletonStoreCacheLoader.java
CacheLoaderManager.java
Log:
Notification changes
Revision Changes Path
1.4 +19 -12 JBossCache/src/org/jboss/cache/loader/SingletonStoreCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SingletonStoreCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/SingletonStoreCacheLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- SingletonStoreCacheLoader.java 2 Feb 2007 14:46:01 -0000 1.3
+++ SingletonStoreCacheLoader.java 28 Jun 2007 16:53:36 -0000 1.4
@@ -2,12 +2,15 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.AbstractCacheListener;
-import org.jboss.cache.CacheListener;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.CacheStarted;
+import org.jboss.cache.notifications.annotation.CacheStopped;
+import org.jboss.cache.notifications.annotation.ViewChanged;
+import org.jboss.cache.notifications.event.Event;
+import org.jboss.cache.notifications.event.ViewChangedEvent;
import org.jgroups.Address;
import org.jgroups.View;
@@ -43,7 +46,7 @@
private boolean active;// only active if coordinator
private boolean pushStateWhenCoordinator;
private Thread pushStateThread;
- private CacheListener cacheListener;
+ private Object cacheListener;
public SingletonStoreCacheLoader(CacheLoader cacheLoader, boolean pushConfiguration)
{
@@ -52,7 +55,7 @@
cacheListener = new SingletonStoreListener();
}
- public CacheListener getCacheListener()
+ public Object getCacheListener()
{
return cacheListener;
}
@@ -255,23 +258,27 @@
* SingletonStoreCacheLoader reacts to these changes in order to decide which node should interact with the
* underlying cache store.
*/
- private class SingletonStoreListener extends AbstractCacheListener
+ @CacheListener
+ private class SingletonStoreListener
{
- public void cacheStarted(CacheSPI cache)
+ @CacheStarted
+ public void cacheStarted(Event e)
{
localAddress = cache.getLocalAddress();
active = cache.getRPCManager().isCoordinator();
- log.debug("cache started: " + this);
+ if (log.isDebugEnabled()) log.debug("cache started: " + this);
}
- public void cacheStopped(CacheSPI cache)
+ @CacheStopped
+ public void cacheStopped(Event e)
{
- log.debug("cache stopped: " + this);
+ if (log.isDebugEnabled()) log.debug("cache stopped: " + this);
}
- public void viewChange(View newView)
+ @ViewChanged
+ public void viewChange(ViewChangedEvent event)
{
- boolean tmp = isCoordinator(newView);
+ boolean tmp = isCoordinator(event.getNewView());
if (active != tmp)
{
1.32 +8 -8 JBossCache/src/org/jboss/cache/loader/CacheLoaderManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/CacheLoaderManager.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- CacheLoaderManager.java 17 Apr 2007 07:47:54 -0000 1.31
+++ CacheLoaderManager.java 28 Jun 2007 16:53:36 -0000 1.32
@@ -8,8 +8,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheListener;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
@@ -198,6 +198,11 @@
return tmpLoader;
}
+ protected void addCacheListener(Cache c, Object listener)
+ {
+ c.addCacheListener(listener);
+ }
+
private CacheLoader createInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException
{
Class cl = Thread.currentThread().getContextClassLoader().loadClass(className);
@@ -369,9 +374,4 @@
}
}
}
-
- protected void addCacheListener(CacheSPI cache, CacheListener listener)
- {
- cache.addCacheListener(listener);
- }
}
More information about the jboss-cvs-commits
mailing list