Author: manik.surtani(a)jboss.com
Date: 2008-01-02 21:27:56 -0500 (Wed, 02 Jan 2008)
New Revision: 4953
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
Cleaned up interceptor implementations
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,6 +1,10 @@
package org.jboss.cache.interceptors;
-import org.jboss.cache.*;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Modification;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -8,8 +12,8 @@
import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
+import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
-import javax.transaction.SystemException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
@@ -47,6 +51,7 @@
isActivation = true;
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveDataMethod(ctx, tx, fqn, createUndoOps);
@@ -58,6 +63,7 @@
return returnValue;
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveNodeMethod(ctx, tx, fqn, createUndoOps);
@@ -69,6 +75,7 @@
return returnValue;
}
+ @Override
protected Object handlePrintMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handlePrintMethod(ctx, fqn);
@@ -76,6 +83,7 @@
return returnValue;
}
+ @Override
protected Object handleReleaseAllLocksMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
Object returnValue = super.handleReleaseAllLocksMethod(ctx, fqn);
@@ -83,6 +91,7 @@
return returnValue;
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
Object returnValue = super.handleGetChildrenNamesMethod(ctx, fqn);
@@ -90,6 +99,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleGetKeysMethod(ctx, fqn);
@@ -97,6 +107,7 @@
return returnValue;
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleGetNodeMethod(ctx, fqn);
@@ -104,6 +115,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key,
boolean sendNodeEvent) throws Throwable
{
Object returnValue = super.handleGetKeyValueMethod(ctx, fqn, key, sendNodeEvent);
@@ -111,6 +123,7 @@
return returnValue;
}
+ @Override
protected Object handleAddChildMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
parentFqn, Object childName, Node cn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleAddChildMethod(ctx, tx, parentFqn, childName, cn,
createUndoOps);
@@ -118,6 +131,7 @@
return returnValue;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
Object returnValue = super.handlePutForExternalReadMethod(ctx, tx, fqn, key,
value);
@@ -125,6 +139,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handlePutDataMethod(ctx, tx, fqn, data, createUndoOps);
@@ -132,6 +147,7 @@
return returnValue;
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handlePutKeyValueMethod(ctx, gtx, fqn, key, value,
createUndoOps);
@@ -139,6 +155,7 @@
return returnValue;
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveKeyMethod(ctx, tx, fqn, key,
createUndoOps);
@@ -146,6 +163,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object returnValue = super.handlePutDataEraseMethod(ctx, gt, fqn, newData,
createUndoOps, eraseContents);
@@ -172,7 +190,8 @@
log.debug("children all initialized");
remove(ctx, fqn);
}
- } else if (loaderNoChildren(fqn))
+ }
+ else if (loaderNoChildren(fqn))
{
if (log.isDebugEnabled()) log.debug("no children " + n);
remove(ctx, fqn);
@@ -180,25 +199,29 @@
}
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{
Object retval = nextInterceptor(ctx);
- if (inTransaction()) {
+ if (inTransaction())
+ {
prepareCacheLoader(ctx);
}
return retval;
}
private boolean inTransaction()
- throws SystemException
+ throws SystemException
{
return tx_mgr != null && tx_mgr.getTransaction() != null;
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx,
List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
Object retval = nextInterceptor(ctx);
- if (inTransaction()) {
+ if (inTransaction())
+ {
prepareCacheLoader(ctx);
}
return retval;
@@ -257,12 +280,14 @@
return m_activations;
}
+ @Override
public void resetStatistics()
{
super.resetStatistics();
m_activations = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = super.dumpStatistics();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -41,6 +41,7 @@
usingBuddyReplication = buddyManager != null && buddyManager.isEnabled();
}
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,6 +1,6 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -9,6 +9,7 @@
import org.jboss.cache.config.Configuration;
import static org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.lock.NodeLock;
@@ -42,6 +43,11 @@
protected CacheLoaderManager clm;
protected boolean usingOptimisticInvalidation = false;
+ public CacheLoaderInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
/**
* True if CacheStoreInterceptor is in place.
* This allows us to skip loading keys for remove(Fqn, key) and put(Fqn, key).
@@ -49,11 +55,6 @@
*/
protected boolean useCacheStore = true;
- protected Log getLog()
- {
- return log;
- }
-
@Inject
protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm,
Configuration configuration)
{
@@ -63,13 +64,13 @@
usingOptimisticInvalidation = configuration.isNodeLockingOptimistic() &&
mode.isInvalidation();
}
- public Object invoke(InvocationContext ctx) throws Throwable
+ @Start
+ protected void startInterceptor()
{
- if (loader == null) loader = clm.getCacheLoader();
- return super.invoke(ctx);
+ loader = clm.getCacheLoader();
}
-
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
if (fqn != null)
@@ -79,6 +80,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
if (fqn != null)
@@ -88,6 +90,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
if (fqn != null)
@@ -97,6 +100,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
if (fqn != null)
@@ -106,6 +110,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws
Throwable
{
if (from != null)
@@ -120,6 +125,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleAddChildMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
parentFqn, Object childName, Node cn, boolean createUndoOps) throws Throwable
{
@@ -131,6 +137,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key,
boolean sendNodeEvent) throws Throwable
{
if (fqn != null)
@@ -140,6 +147,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -149,6 +157,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
if (fqn != null)
@@ -158,6 +167,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleReleaseAllLocksMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
if (fqn != null)
@@ -167,6 +177,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePrintMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -176,6 +187,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -185,6 +197,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
if (fqn != null)
@@ -194,6 +207,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
// clean up nodesCreated map
@@ -221,6 +235,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
if (cache.getConfiguration().isNodeLockingOptimistic() && fqn != null)
@@ -230,6 +245,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
if (fqn != null && !useCacheStore)
@@ -239,6 +255,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
if (fqn != null && !useCacheStore)
@@ -424,12 +441,14 @@
return m_cacheMisses;
}
+ @Override
public void resetStatistics()
{
m_cacheLoads = 0;
m_cacheMisses = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -21,12 +21,11 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.CacheSPI;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Fqn;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.apache.commons.logging.Log;
import java.util.HashMap;
import java.util.Map;
@@ -49,21 +48,18 @@
private long m_start = System.currentTimeMillis();
private long m_reset = m_start;
- public void setCache(CacheSPI cache)
+ public CacheMgmtInterceptor()
{
- super.setCache(cache);
+ log = LogFactory.getLog(getClass());
}
- protected Log getLog()
- {
- return log;
- }
-
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
return !getStatisticsEnabled();
}
+ @Override
protected Object handleEvictMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -71,6 +67,7 @@
return returnValue;
}
+ @Override
protected Object handleEvictVersionedNodeMethod(InvocationContext ctx, Fqn fqn,
DataVersion dataVersion) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -78,6 +75,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key,
boolean sendNodeEvent) throws Throwable
{
long t1 = System.currentTimeMillis();
@@ -87,7 +85,8 @@
{
m_miss_times = m_miss_times + (t2 - t1);
m_misses++;
- } else
+ }
+ else
{
m_hit_times = m_hit_times + (t2 - t1);
m_hits++;
@@ -95,18 +94,20 @@
return retval;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
return handlePutData(ctx, data);
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
return handlePutData(ctx, newData);
}
private Object handlePutData(InvocationContext ctx, Map data)
- throws Throwable
+ throws Throwable
{
long t1 = System.currentTimeMillis();
Object retval = nextInterceptor(ctx);
@@ -120,18 +121,20 @@
return retval;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
return handlePutExternalAndKeyValue(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutExternalAndKeyValue(ctx);
}
private Object handlePutExternalAndKeyValue(InvocationContext ctx)
- throws Throwable
+ throws Throwable
{
long t1 = System.currentTimeMillis();
Object retval = nextInterceptor(ctx);
@@ -211,6 +214,7 @@
return (System.currentTimeMillis() - m_reset) / 1000;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
@@ -229,6 +233,7 @@
return retval;
}
+ @Override
public void resetStatistics()
{
m_hits = 0;
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,13 +1,13 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -45,30 +45,25 @@
private long m_cacheStores = 0;
protected CacheLoader loader;
- protected Log getLog()
+
+ public CacheStoreInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
- public void setCache(CacheSPI cache)
+ @Start
+ protected void startInterceptor()
{
- super.setCache(cache);
+ loader = cache.getCacheLoaderManager().getCacheLoader();
this.loaderConfig = cache.getCacheLoaderManager().getCacheLoaderConfig();
tx_mgr = cache.getTransactionManager();
tx_table = cache.getTransactionTable();
- this.loader = cache.getCacheLoaderManager().getCacheLoader();
}
- public Object invoke(InvocationContext ctx) throws Throwable
- {
- if (loaderConfig == null) loaderConfig =
cache.getCacheLoaderManager().getCacheLoaderConfig();
- if (loader == null) loader = cache.getCacheLoaderManager().getCacheLoader();
- return super.invoke(ctx);
- }
-
/**
* if this is a shared cache loader and the call is of remote origin, pass up the
chain
*/
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
if (!ctx.isOriginLocal() && loaderConfig.isShared())
@@ -82,6 +77,7 @@
return false;
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction gtx)
throws Throwable
{
if (inTransaction())
@@ -129,6 +125,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction gtx)
throws Throwable
{
if (inTransaction())
@@ -155,6 +152,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{
if (inTransaction())
@@ -165,6 +163,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx,
List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
if (inTransaction())
@@ -179,6 +178,7 @@
* remove() methods need to be applied to the CacheLoader before passing up the call:
a listener might
* access an element just removed, causing the CacheLoader to *load* the element
before *removing* it.
*/
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -191,6 +191,7 @@
/**
* @see #handleRemoveNodeMethod(org.jboss.cache.InvocationContext,
org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, boolean)
*/
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -205,6 +206,7 @@
/**
* @see #handleRemoveNodeMethod(org.jboss.cache.InvocationContext,
org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, boolean)
*/
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -220,6 +222,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws
Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -233,6 +236,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -247,6 +251,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -262,11 +267,13 @@
return returnValue;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
return handlePutKeyValue(ctx, fqn, key, value);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutKeyValue(ctx, fqn, key, value);
@@ -332,11 +339,13 @@
return m_cacheStores;
}
+ @Override
public void resetStatistics()
{
m_cacheStores = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
@@ -50,9 +49,9 @@
{
private BuddyManager buddyManager;
private boolean syncCommunications = false;
- private Log log = LogFactory.getLog(DataGravitatorInterceptor.class);
private Map<GlobalTransaction, MethodCall> transactionMods = new
ConcurrentHashMap<GlobalTransaction, MethodCall>();
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
@@ -60,47 +59,55 @@
syncCommunications = configuration.getCacheMode() ==
Configuration.CacheMode.REPL_SYNC || configuration.getCacheMode() ==
Configuration.CacheMode.INVALIDATION_SYNC;
}
- protected Log getLog()
+ public DataGravitatorInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
return MethodDeclarations.isBlockUnblockMethod(ctx.getMethodCall().getMethodId())
||
ctx.getOptionOverrides().isSkipDataGravitation();
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleExistsMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key,
boolean sendNodeEvent) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx,
List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
try
@@ -117,11 +124,13 @@
}
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{
return handlePrepareMethod(ctx, gtx, modifications, address, onePhaseCommit);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
try
@@ -136,6 +145,7 @@
}
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
try
@@ -282,28 +292,6 @@
log.trace("Got response " + gr);
}
-// if (configuration.isUseRegionBasedMarshalling())
-// {
-// ClassLoader cl = Thread.currentThread().getContextClassLoader();
-// try
-// {
-// cache.getRegionManager().setContextClassLoaderAsCurrent(name);
-//
-// byte[] nodeData = (byte[]) resp[0];
-// ByteArrayInputStream bais = new ByteArrayInputStream(nodeData);
-// MarshalledValueInputStream mais = new MarshalledValueInputStream(bais);
-// nodes = (List) mais.readObject();
-// mais.close();
-// }
-// finally
-// {
-// Thread.currentThread().setContextClassLoader(cl);
-// }
-// }
-// else
-// {
-// }
-
result = new BackupData(name, gr);
}
@@ -312,18 +300,6 @@
private void cleanBackupData(BackupData backup, GlobalTransaction gtx,
InvocationContext ctx) throws Throwable
{
- // MethodCall primaryDataCleanup, backupDataCleanup;
- // if (buddyManager.isDataGravitationRemoveOnFind())
- // {
- // primaryDataCleanup =
MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null,
backup.primaryFqn, Boolean.FALSE});
- // backupDataCleanup =
MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null,
backup.backupFqn, Boolean.FALSE});
- // }
- // else
- // {
- // primaryDataCleanup =
MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new
Object[]{backup.primaryFqn});
- // backupDataCleanup =
MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new
Object[]{backup.backupFqn});
- // }
-
MethodCall cleanup =
MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod,
backup.primaryFqn, backup.backupFqn);
@@ -332,11 +308,8 @@
{
// broadcast removes
// remove main Fqn
- //replicateCall(cache.getMembers(), primaryDataCleanup, syncCommunications);
-
if (log.isTraceEnabled()) log.trace("Performing cleanup on [" +
backup.backupFqn + "]");
// remove backup Fqn
- //replicateCall(cache.getMembers(), backupDataCleanup, syncCommunications);
replicateCall(cache.getMembers(), cleanup, syncCommunications,
ctx.getOptionOverrides(), false);
}
else
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -7,7 +7,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -33,8 +32,6 @@
*/
public class EvictionInterceptor extends MethodDispacherInterceptor
{
- private static final Log log = LogFactory.getLog(EvictionInterceptor.class);
-
protected RegionManager regionManager;
/**
@@ -49,16 +46,18 @@
this.regionManager = regionManager;
}
- protected Log getLog()
+ public EvictionInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected Object handleEvictVersionedNodeMethod(InvocationContext ctx, Fqn fqn,
DataVersion dataVersion) throws Throwable
{
return handleEvictMethod(ctx, fqn);
}
+ @Override
protected Object handleEvictMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -76,11 +75,13 @@
return retVal;
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutForExternalReadMethod(ctx, gtx, fqn, key, value);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -91,6 +92,7 @@
return retVal;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -118,6 +120,7 @@
return retVal;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -144,6 +147,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -165,6 +169,7 @@
return retVal;
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -185,11 +190,13 @@
return retVal;
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws
Throwable
{
return handleGetNodeMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key,
boolean sendNodeEvent) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -207,6 +214,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -217,6 +225,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx,
Fqn fqn, boolean createUndoOps) throws Throwable
{
return handleRemoveNodeMethod(ctx, tx, fqn, createUndoOps);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -54,10 +54,14 @@
protected Map<GlobalTransaction, List<MethodCall>> txMods;
protected boolean optimistic;
+ public InvalidationInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
public void setCache(CacheSPI cache)
{
super.setCache(cache);
-// txTable = cache.getTransactionTable();
optimistic = configuration.isNodeLockingOptimistic();
if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction,
List<MethodCall>>();
}
@@ -68,11 +72,6 @@
this.txTable = txTable;
}
- protected Log getLog()
- {
- return log;
- }
-
protected boolean skipMethodCall(InvocationContext ctx)
{
Option optionOverride = ctx.getOptionOverrides();
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCall;
@@ -23,11 +23,12 @@
*/
public class InvocationContextInterceptor extends BaseTransactionalContextInterceptor
implements InvocationContextInterceptorMBean
{
- protected Log getLog()
+ public InvocationContextInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
public Object invoke(InvocationContext ctx) throws Throwable
{
MethodCall call = ctx.getMethodCall();
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,6 +1,5 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
@@ -33,7 +32,6 @@
* @author Mircea.Markus(a)jboss.com
* @version 2.1.0
* todo - Refactor stuff in txint
- * todo - revisit backward compatibility
*/
public abstract class MethodDispacherInterceptor extends Interceptor
{
@@ -52,7 +50,7 @@
*/
public Object invoke(InvocationContext ctx) throws Throwable
{
- if (getLog() != null && getLog().isTraceEnabled())
+ if (log.isTraceEnabled())
{
log.trace("Invoked with method call " + ctx.getMethodCall());
}
@@ -275,11 +273,6 @@
}
/**
- * used for logging various steps. if null is returned than nothing is logged.
- */
- protected abstract Log getLog();
-
- /**
* Each interceptor should extend this if it does not need any processing for current
call.
* An sample usage would be: this interceptor is only interested if thre is one
transaction going on. If so all
* handleXYZ would know that we have a transaction going and would not check its
state.
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,10 +1,8 @@
package org.jboss.cache.interceptors;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodDeclarations;
-import org.apache.commons.logging.Log;
/**
* The interceptor in charge of firing off notifications to cache listeners
@@ -14,11 +12,12 @@
*/
public class NotificationInterceptor extends BaseTransactionalContextInterceptor
{
- protected Log getLog()
+ public NotificationInterceptor()
{
- return null;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected Object handleBlockChannelMethod(InvocationContext ctx) throws Throwable
{
cache.getNotifier().notifyCacheBlocked(cache, true);
@@ -27,6 +26,7 @@
return retVal;
}
+ @Override
protected Object handleUnblockChannelMethod(InvocationContext ctx) throws Throwable
{
cache.getNotifier().notifyCacheUnblocked(cache, true);
@@ -35,6 +35,7 @@
return retval;
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
// notify commit
@@ -44,6 +45,7 @@
return retval;
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
Object retval = nextInterceptor(ctx);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -46,54 +46,63 @@
this.nodeFactory = nodeFactory;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataEraseVersionedMethod(InvocationContext ctx,
GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContent,
DataVersion dv) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx,
Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt,
Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataVersionedMethod(InvocationContext ctx, GlobalTransaction
globalTransaction, Fqn fqn, Map map, Boolean createUndoOps, DataVersion dataVersion)
throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueVersionedMethod(InvocationContext ctx,
GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps,
DataVersion dv) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx,
GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadVersionedMethod(InvocationContext ctx,
GlobalTransaction gtx, Fqn fqn, Object key, Object value, DataVersion dv) throws
Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws
Throwable
{
List<Fqn> fqns = new ArrayList<Fqn>();
@@ -135,13 +144,6 @@
List<Fqn> nodesCreated = new ArrayList<Fqn>();
- // synchronize on the workspace so that more than one thread doesn't attempt to
put stuff into the workspace for
- // the same transaction. Isn't this unlikely though, given that each
transaction would only occur in a single thread
- // at a time?
-/*
- synchronized (workspace)
- {
-*/
DataVersion version = null;
if (ctx.getOptionOverrides() != null &&
ctx.getOptionOverrides().getDataVersion() != null)
{
@@ -272,8 +274,6 @@
}
}
- //}// end sync block
-
if (!suppressNotification)
{
if (nodesCreated.size() > 0)
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -26,17 +25,12 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani
(manik(a)jboss.org)</a>
*/
-public class OptimisticInterceptor extends MethodDispacherInterceptor
+public abstract class OptimisticInterceptor extends MethodDispacherInterceptor
{
protected TransactionManager txManager = null;
protected TransactionTable txTable = null;
protected boolean trace;
- protected Log getLog()
- {
- return null;
- }
-
@Inject
private void injectDependencies(TransactionManager txManager, TransactionTable
txTable)
{
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -34,13 +34,14 @@
{
private long lockAcquisitionTimeout;
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
lockAcquisitionTimeout = cache.getConfiguration().getLockAcquisitionTimeout();
}
-
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{
//try and acquire the locks - before passing on
@@ -96,16 +97,19 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
return transactionFinalized(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
return transactionFinalized(ctx);
}
+ @Override
protected Object handleLockMethod(InvocationContext ctx, Fqn fqn, NodeLock.LockType
lockType, boolean recursive)
{
// bail out if _lock() is being called on the tree cache... this should never be
called with o/l enabled.
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -51,6 +51,7 @@
this.nodeFactory = nodeFactory;
}
+ @Override
public Object invoke(InvocationContext ctx) throws Throwable
{
MethodCall m = ctx.getMethodCall();
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -47,10 +47,9 @@
// we really just need a set here, but concurrent CopyOnWriteArraySet has poor
performance when writing.
private final Set<GlobalTransaction> broadcastTxs = new
ConcurrentHashSet<GlobalTransaction>();
-
- protected Log getLog()
+ public OptimisticReplicationInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
@Override
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -47,6 +47,7 @@
{
private boolean useTombstones;
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
@@ -54,6 +55,7 @@
useTombstones = (mode == CacheMode.INVALIDATION_ASYNC) || (mode ==
CacheMode.INVALIDATION_SYNC);
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{
TransactionWorkspace workspace =
getTransactionWorkspace(getGlobalTransaction(ctx));
@@ -90,7 +92,8 @@
if (underlyingNode != null && !underlyingNode.isValid())
{
// we havea tombstone
- if (!workspaceNode.isCreated() && !workspaceNode.isDeleted())
throw new DataVersioningException("Underlying node doesn't exist but a tombstone
does; workspace node should be marked as created!");
+ if (!workspaceNode.isCreated() && !workspaceNode.isDeleted())
+ throw new DataVersioningException("Underlying node doesn't
exist but a tombstone does; workspace node should be marked as created!");
if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
{
// we have an out of date node here
@@ -126,6 +129,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
GlobalTransaction gtx = getGlobalTransaction(ctx);
@@ -235,6 +239,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction
globalTransaction) throws Throwable
{
TransactionWorkspace workspace;
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,11 +1,11 @@
package org.jboss.cache.interceptors;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.loader.CacheLoader;
-import org.apache.commons.logging.Log;
import java.util.Collections;
import java.util.HashMap;
@@ -25,19 +25,20 @@
protected CacheLoader loader = null;
private AtomicLong m_passivations = new AtomicLong(0);
+ public PassivationInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
+
public void setCache(CacheSPI cache)
{
super.setCache(cache);
this.loader = cache.getCacheLoaderManager().getCacheLoader();
}
- protected Log getLog()
- {
- return null;
- }
-
/**
- * Notifies the cache instance listeners that the evicted node is about to
+ * Notifies the cache instance listeners that the evicted node is about to
* be passivated and stores the evicted node and its attributes back to the
* store using the CacheLoader.
*/
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -59,6 +59,11 @@
private Map<Thread, List<NodeLock>> lockTable;
private long lock_acquisition_timeout;
+ public PessimisticLockInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
@Inject
public void injectDependencies(@ComponentName("LockTable")Map<Thread,
List<NodeLock>> lockTable, Configuration configuration, CacheImpl cacheImpl,
TransactionTable txTable)
{
@@ -68,11 +73,6 @@
this.tx_table = txTable;
}
- protected Log getLog()
- {
- return log;
- }
-
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn
fqn, Map data, boolean createUndoOps) throws Throwable
{
return handlePutMethod(ctx, fqn);
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -1,6 +1,6 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Configuration;
@@ -24,13 +24,11 @@
*/
public class ReplicationInterceptor extends BaseRpcInterceptor
{
-
- protected Log getLog()
+ public ReplicationInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
-
protected boolean skipMethodCall(InvocationContext ctx)
{
Option optionOverride = ctx.getOptionOverrides();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03
01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03
02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -56,12 +56,11 @@
private long m_rollbacks = 0;
- protected Log getLog()
+ public TxInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
-
@SuppressWarnings("unchecked")
protected Object handleOptimisticPrepareMethod(InvocationContext ctx,
GlobalTransaction gtx, List modifications, Map data, Address address, boolean
onePhaseCommit) throws Throwable
{