org.infinispan.interceptors
Class DistCacheStoreInterceptor

java.lang.Object
  extended by org.infinispan.commands.AbstractVisitor
      extended by org.infinispan.interceptors.base.CommandInterceptor
          extended by org.infinispan.interceptors.base.JmxStatsCommandInterceptor
              extended by org.infinispan.interceptors.CacheStoreInterceptor
                  extended by org.infinispan.interceptors.DistCacheStoreInterceptor
All Implemented Interfaces:
Visitor, JmxStatisticsExposer

public class DistCacheStoreInterceptor
extends CacheStoreInterceptor

Cache store interceptor specific for the distribution cache mode. Put operations has been modified in such way that if they put operation is the result of an L1 put, storing in the cache store is ignore. This is done so that immortal entries that get converted into mortal ones when putting into L1 don't get propagated to the cache store.

Secondly, in a replicated environment where a shared cache store is used, the node in which the cache operation is executed is the one responsible for interacting with the cache. This doesn't work with distributed mode and instead, in a shared cache store situation, the first owner of the key is the one responsible for storing it.

In the particular case of putAll(), individual keys are checked and if a shared cache store environment has been configured, only the first owner of that key will actually store it to the cache store. In a unshared environment though, only those nodes that are owners of the key would store it to their local cache stores.

Since:
4.0
Author:
Galder ZamarreƱo

Nested Class Summary
 
Nested classes/interfaces inherited from class org.infinispan.interceptors.CacheStoreInterceptor
CacheStoreInterceptor.StoreModificationsBuilder
 
Field Summary
 
Fields inherited from class org.infinispan.interceptors.base.CommandInterceptor
configuration
 
Constructor Summary
DistCacheStoreInterceptor()
           
 
Method Summary
protected  Log getLog()
           
 void inject(DistributionManager dm, Transport transport)
           
protected  boolean skip(InvocationContext ctx)
          Method that skips invocation if: - No store defined or, - The context contains Flag.SKIP_CACHE_STORE or,
protected  boolean skipKey(Object key)
          Method that skips invocation if: - The store is a shared one and node storing the key is not the 1st owner of the key or, - This is an L1 put operation.
 Object visitClearCommand(InvocationContext ctx, ClearCommand command)
           
 Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command)
           
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
 Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
           
 Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
           
 Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command)
           
 
Methods inherited from class org.infinispan.interceptors.CacheStoreInterceptor
clearCacheStore, commitCommand, getCacheLoaderStores, init, prepareCacheLoader, resetStatistics, start, visitCommitCommand, visitRollbackCommand
 
Methods inherited from class org.infinispan.interceptors.base.JmxStatsCommandInterceptor
checkStatisticsUsed, getStatisticsEnabled, setStatisticsEnabled
 
Methods inherited from class org.infinispan.interceptors.base.CommandInterceptor
getNext, handleDefault, hasNext, invokeNextInterceptor, setNext
 
Methods inherited from class org.infinispan.commands.AbstractVisitor
visitApplyDeltaCommand, visitCollection, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitSizeCommand, visitUnknownCommand, visitValuesCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistCacheStoreInterceptor

public DistCacheStoreInterceptor()
Method Detail

getLog

protected Log getLog()
Overrides:
getLog in class CacheStoreInterceptor

inject

public void inject(DistributionManager dm,
                   Transport transport)

visitPutKeyValueCommand

public Object visitPutKeyValueCommand(InvocationContext ctx,
                                      PutKeyValueCommand command)
                               throws Throwable
Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class CacheStoreInterceptor
Throws:
Throwable

visitPutMapCommand

public Object visitPutMapCommand(InvocationContext ctx,
                                 PutMapCommand command)
                          throws Throwable
Specified by:
visitPutMapCommand in interface Visitor
Overrides:
visitPutMapCommand in class CacheStoreInterceptor
Throws:
Throwable

visitRemoveCommand

public Object visitRemoveCommand(InvocationContext ctx,
                                 RemoveCommand command)
                          throws Throwable
Specified by:
visitRemoveCommand in interface Visitor
Overrides:
visitRemoveCommand in class CacheStoreInterceptor
Throws:
Throwable

visitReplaceCommand

public Object visitReplaceCommand(InvocationContext ctx,
                                  ReplaceCommand command)
                           throws Throwable
Specified by:
visitReplaceCommand in interface Visitor
Overrides:
visitReplaceCommand in class CacheStoreInterceptor
Throws:
Throwable

visitPrepareCommand

public Object visitPrepareCommand(TxInvocationContext ctx,
                                  PrepareCommand command)
                           throws Throwable
Specified by:
visitPrepareCommand in interface Visitor
Overrides:
visitPrepareCommand in class CacheStoreInterceptor
Throws:
Throwable

visitClearCommand

public Object visitClearCommand(InvocationContext ctx,
                                ClearCommand command)
                         throws Throwable
Specified by:
visitClearCommand in interface Visitor
Overrides:
visitClearCommand in class CacheStoreInterceptor
Throws:
Throwable

skip

protected boolean skip(InvocationContext ctx)
Method that skips invocation if: - No store defined or, - The context contains Flag.SKIP_CACHE_STORE or,

Overrides:
skip in class CacheStoreInterceptor

skipKey

protected boolean skipKey(Object key)
Method that skips invocation if: - The store is a shared one and node storing the key is not the 1st owner of the key or, - This is an L1 put operation.

Overrides:
skipKey in class CacheStoreInterceptor

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.