org.jboss.cache.interceptors
Class CacheStoreInterceptor

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

public class CacheStoreInterceptor
extends BaseCacheLoaderInterceptor
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.26 2006/06/12 20:24:31 msurtani Exp $
Author:
Bela Ban

Field Summary
protected  CacheLoaderConfig loaderConfig
           
protected  javax.transaction.TransactionManager tx_mgr
           
protected  TransactionTable tx_table
           
 
Fields inherited from class org.jboss.cache.interceptors.BaseCacheLoaderInterceptor
loader
 
Constructor Summary
CacheStoreInterceptor()
           
 
Method Summary
protected  Modification convertMethodCallToModification(JBCMethodCall methodCall)
           
 java.util.Map dumpStatistics()
          Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries
 long getCacheLoaderStores()
          Returns the number of cache loader stores
 java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
          Pass the method on.
 void resetStatistics()
          Resets an interceptor's cache statistics
 void setCache(TreeCache cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.BaseCacheLoaderInterceptor
obtainLoaderLock, obtainLoaderLocks, releaseLoaderLock, releaseLoaderLocks
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getInvocationContext, getNext, getStatisticsEnabled, isActive, isBuddyGroupOrganisationMethod, isOnePhaseCommitPrepareMehod, isPreparing, isTransactionLifecycleMethod, isValid, setInvocationContext, setNext, setStatisticsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
Constructor Detail

CacheStoreInterceptor

public CacheStoreInterceptor()
Method Detail

setCache

public void setCache(TreeCache cache)
Overrides:
setCache in class BaseCacheLoaderInterceptor

invoke

public java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
                        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
Parameters:
call -
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 interface: InterceptorMBean
Resets an interceptor's cache statistics

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

dumpStatistics

public java.util.Map dumpStatistics()
Description copied from interface: InterceptorMBean
Returns a map of the cache interceptor's statistics Map elements consist of {String name, Object value} entries

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

convertMethodCallToModification

protected Modification convertMethodCallToModification(JBCMethodCall methodCall)
                                                throws java.lang.Exception
Throws:
java.lang.Exception


Copyright 1998-2005 JBoss Inc . All Rights Reserved.