org.jboss.cache.interceptors
Class CacheStoreInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.CacheStoreInterceptor
All Implemented Interfaces:
CacheStoreInterceptorMBean, InterceptorMBean

public class CacheStoreInterceptor
extends Interceptor
implements CacheStoreInterceptorMBean

Writes modifications back to the store on the way out: stores modifications back through the CacheLoader, either after each method call (no TXs), or at TX commit.

Version:
$Id: CacheStoreInterceptor.java,v 1.54 2007/07/17 14:10:21 msurtani Exp $
Author:
Bela Ban

Field Summary
protected  CacheLoader loader
           
protected  CacheLoaderConfig loaderConfig
           
protected  javax.transaction.TransactionManager tx_mgr
           
protected  TransactionTable tx_table
           
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next
 
Constructor Summary
CacheStoreInterceptor()
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> dumpStatistics()
          This implementation returns an empty Map.
 long getCacheLoaderStores()
          Returns the number of cache loader stores
 java.lang.Object invoke(InvocationContext ctx)
          Pass the method on.
 void resetStatistics()
          This implementation is a no-op.
 void setCache(CacheSPI cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getLast, getNext, getStatisticsEnabled, isActive, isOnePhaseCommitPrepareMehod, isPreparing, isValid, setLast, setNext, setStatisticsEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.interceptors.InterceptorMBean
getStatisticsEnabled, setStatisticsEnabled
 

Field Detail

loaderConfig

protected CacheLoaderConfig loaderConfig

tx_mgr

protected javax.transaction.TransactionManager tx_mgr

tx_table

protected TransactionTable tx_table

loader

protected CacheLoader loader
Constructor Detail

CacheStoreInterceptor

public CacheStoreInterceptor()
Method Detail

setCache

public void setCache(CacheSPI cache)
Overrides:
setCache in class Interceptor

invoke

public java.lang.Object invoke(InvocationContext ctx)
                        throws java.lang.Throwable
Pass the method on. When it returns, store the modification back to the store using the CacheLoader. In case of a transaction, register for TX completion (2PC) and at TX commit, write modifications made under the given TX to the CacheLoader

Overrides:
invoke in class Interceptor
Returns:
Throws:
java.lang.Throwable

getCacheLoaderStores

public long getCacheLoaderStores()
Description copied from interface: CacheStoreInterceptorMBean
Returns the number of cache loader stores

Specified by:
getCacheLoaderStores in interface CacheStoreInterceptorMBean
Returns:
the number of cache loader stores

resetStatistics

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

Specified by:
resetStatistics in interface InterceptorMBean
Overrides:
resetStatistics in class Interceptor

dumpStatistics

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

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