org.jboss.cache.interceptors
Class Interceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
All Implemented Interfaces:
InterceptorMBean
Direct Known Subclasses:
BaseRpcInterceptor, BaseTransactionalContextInterceptor, CacheLoaderInterceptor, CacheMgmtInterceptor, CacheStoreInterceptor, CallInterceptor, EvictionInterceptor, OptimisticInterceptor, PassivationInterceptor, PessimisticLockInterceptor, UnlockInterceptor

public abstract class Interceptor
extends java.lang.Object
implements InterceptorMBean

Class representing an interceptor. Note that this will be replaced by Interceptor in one of the next releases

Version:
$Id: Interceptor.java,v 1.28 2007/05/23 15:22:03 msurtani Exp $
Author:
Bela Ban

Field Summary
protected  CacheSPI<?,?> cache
           
protected  Configuration configuration
           
protected  Interceptor last
           
protected  org.apache.commons.logging.Log log
           
protected  Interceptor next
           
 
Constructor Summary
Interceptor()
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> dumpStatistics()
          This implementation returns an empty Map.
 Interceptor getLast()
           
 Interceptor getNext()
           
 boolean getStatisticsEnabled()
          Returns whether an interceptor's statistics are being captured.
 java.lang.Object invoke(InvocationContext ctx)
           
protected  boolean isActive(javax.transaction.Transaction tx)
          Returns true if transaction is ACTIVE, false otherwise
protected  boolean isOnePhaseCommitPrepareMehod(MethodCall m)
          This only works for prepare() and optimisticPrepare() method calls.
protected  boolean isPreparing(javax.transaction.Transaction tx)
          Returns true if transaction is PREPARING, false otherwise
protected  boolean isValid(javax.transaction.Transaction tx)
          Return s true of tx's status is ACTIVE or PREPARING
 void resetStatistics()
          This implementation is a no-op.
 void setCache(CacheSPI cache)
           
 void setLast(Interceptor last)
           
 void setNext(Interceptor i)
           
 void setStatisticsEnabled(boolean enabled)
          Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

protected Interceptor next

last

protected Interceptor last

cache

protected CacheSPI<?,?> cache

log

protected org.apache.commons.logging.Log log

configuration

protected Configuration configuration
Constructor Detail

Interceptor

public Interceptor()
Method Detail

setNext

public void setNext(Interceptor i)

getNext

public Interceptor getNext()

setCache

public void setCache(CacheSPI cache)

invoke

public java.lang.Object invoke(InvocationContext ctx)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable

getStatisticsEnabled

public boolean getStatisticsEnabled()
Description copied from interface: InterceptorMBean
Returns whether an interceptor's statistics are being captured.

Specified by:
getStatisticsEnabled in interface InterceptorMBean
Returns:
true if statistics are captured

setStatisticsEnabled

public void setStatisticsEnabled(boolean enabled)
Description copied from interface: InterceptorMBean
Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.

Specified by:
setStatisticsEnabled in interface InterceptorMBean
Parameters:
enabled - true if statistics should be captured

getLast

public Interceptor getLast()

setLast

public void setLast(Interceptor last)

dumpStatistics

public java.util.Map<java.lang.String,java.lang.Object> dumpStatistics()
This implementation returns an empty Map. If individual Interceptors wish to expose statistics, they can override this method.

Specified by:
dumpStatistics in interface InterceptorMBean
Returns:
a map containing statistics

resetStatistics

public void resetStatistics()
This implementation is a no-op. If individual Interceptors wish to expose statistics, they can override this method.

Specified by:
resetStatistics in interface InterceptorMBean

isActive

protected boolean isActive(javax.transaction.Transaction tx)
Returns true if transaction is ACTIVE, false otherwise


isPreparing

protected boolean isPreparing(javax.transaction.Transaction tx)
Returns true if transaction is PREPARING, false otherwise


isValid

protected boolean isValid(javax.transaction.Transaction tx)
Return s true of tx's status is ACTIVE or PREPARING

Parameters:
tx -
Returns:
true if the tx is active or preparing

isOnePhaseCommitPrepareMehod

protected boolean isOnePhaseCommitPrepareMehod(MethodCall m)
This only works for prepare() and optimisticPrepare() method calls.

Parameters:
m -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object