public class ScatteredCacheWriterInterceptor extends CacheWriterInterceptor
DistCacheWriterInterceptor but as commands are not forwarded from primary owner
so we just write to the store all the time (with non-shared interceptors).
Uses its own locking scheme to order writes into the store - if there is a newer write into DC,
the older write is ignored. This could improve contented case, but has one strange property:
Assume CS contains V1, T2 writes V2 and T3 writes V3; if T2 receives version and stores into DC
before T3 but arrives here after T3 the V2 write into CS is ignored but the operation is confirmed
as if it was persisted correctly.
If T3 then (spuriously) fails to write into the store, V1 stays in CS but the error is reported
only to T3 - that means that T3 effectivelly rolled back V2 into V1 (and reported this as an error).
This may surprise some users.
Reads can be blocked by ongoing writes, though; when T2 finishes and then the application attempts
to read the value, and removal from T3 is not complete yet the read would not find the value in DC
(because it was removed by T3) but could load V1 from cache store. Therefore, read must wait until
the current write (that could have interacted with previous write) finishes.
TODO: block writes until other write completes, and don't block reads
However, blocking reads in cachestore is not something unusual; the DC lock is acquired when writing
the cache store during eviction/passivation, or during write skew checks in other modes as well.| Modifier and Type | Class and Description |
|---|---|
class |
ScatteredCacheWriterInterceptor.LockTimeoutFuture |
handlePutMapCommandReturn, persistenceManagercacheConfiguration| Constructor and Description |
|---|
ScatteredCacheWriterInterceptor() |
commitCommand, getNumberOfPersistedEntries, getWritesToTheStores, handlePutMapCommandReturn, isProperWriter, isStoreEnabled, resetStatistics, store, visitClearCommand, visitCommitCommand, visitPrepareCommandgetStatisticsEnabled, onStart, setStatisticsEnabledhandleDefault, visitCommand, visitEntrySetCommand, visitEvictCommand, visitGetKeysInGroupCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitReadOnlyKeyCommand, visitReadOnlyManyCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommandasyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedNull, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrExceptionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitRemoveExpiredCommandprotected Log getLog()
getLog in class CacheWriterInterceptorpublic void start()
start in class CacheWriterInterceptorpublic Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
visitGetKeyValueCommand in interface VisitorvisitGetKeyValueCommand in class DDAsyncInterceptorThrowablepublic Object visitGetCacheEntryCommand(InvocationContext ctx, GetCacheEntryCommand command) throws Throwable
visitGetCacheEntryCommand in interface VisitorvisitGetCacheEntryCommand in class DDAsyncInterceptorThrowablepublic Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable
visitGetAllCommand in interface VisitorvisitGetAllCommand in class DDAsyncInterceptorThrowablepublic Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
visitPutKeyValueCommand in interface VisitorvisitPutKeyValueCommand in class CacheWriterInterceptorThrowablepublic Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command) throws Throwable
visitReplaceCommand in interface VisitorvisitReplaceCommand in class CacheWriterInterceptorThrowablepublic Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
visitRemoveCommand in interface VisitorvisitRemoveCommand in class CacheWriterInterceptorThrowablepublic Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable
visitComputeCommand in interface VisitorvisitComputeCommand in class CacheWriterInterceptorThrowablepublic Object visitComputeIfAbsentCommand(InvocationContext ctx, ComputeIfAbsentCommand command) throws Throwable
visitComputeIfAbsentCommand in interface VisitorvisitComputeIfAbsentCommand in class CacheWriterInterceptorThrowablepublic Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
visitPutMapCommand in interface VisitorvisitPutMapCommand in class CacheWriterInterceptorThrowablepublic Object visitReadWriteKeyCommand(InvocationContext ctx, ReadWriteKeyCommand command) throws Throwable
visitReadWriteKeyCommand in interface VisitorvisitReadWriteKeyCommand in class CacheWriterInterceptorThrowablepublic Object visitReadWriteKeyValueCommand(InvocationContext ctx, ReadWriteKeyValueCommand command) throws Throwable
visitReadWriteKeyValueCommand in interface VisitorvisitReadWriteKeyValueCommand in class CacheWriterInterceptorThrowablepublic Object visitWriteOnlyKeyCommand(InvocationContext ctx, WriteOnlyKeyCommand command) throws Throwable
visitWriteOnlyKeyCommand in interface VisitorvisitWriteOnlyKeyCommand in class CacheWriterInterceptorThrowablepublic Object visitWriteOnlyKeyValueCommand(InvocationContext ctx, WriteOnlyKeyValueCommand command) throws Throwable
visitWriteOnlyKeyValueCommand in interface VisitorvisitWriteOnlyKeyValueCommand in class CacheWriterInterceptorThrowablepublic Object visitWriteOnlyManyCommand(InvocationContext ctx, WriteOnlyManyCommand command) throws Throwable
visitWriteOnlyManyCommand in interface VisitorvisitWriteOnlyManyCommand in class CacheWriterInterceptorThrowablepublic Object visitWriteOnlyManyEntriesCommand(InvocationContext ctx, WriteOnlyManyEntriesCommand command) throws Throwable
visitWriteOnlyManyEntriesCommand in interface VisitorvisitWriteOnlyManyEntriesCommand in class CacheWriterInterceptorThrowablepublic Object visitReadWriteManyCommand(InvocationContext ctx, ReadWriteManyCommand command) throws Throwable
visitReadWriteManyCommand in interface VisitorvisitReadWriteManyCommand in class CacheWriterInterceptorThrowablepublic Object visitReadWriteManyEntriesCommand(InvocationContext ctx, ReadWriteManyEntriesCommand command) throws Throwable
visitReadWriteManyEntriesCommand in interface VisitorvisitReadWriteManyEntriesCommand in class CacheWriterInterceptorThrowableprotected boolean skipSharedStores(InvocationContext ctx, Object key, FlagAffectedCommand command)
skipSharedStores in class CacheWriterInterceptorCopyright © 2022 JBoss by Red Hat. All rights reserved.