Package de.hybris.platform.tx
Class InvalidationSet
- java.lang.Object
-
- de.hybris.platform.tx.InvalidationSet
-
- Direct Known Subclasses:
Transaction.TxInvalidationSet
@NotThreadSafe public class InvalidationSet extends java.lang.Object
Collects delayed invalidations and records simulated / derived invalidations too.This class is intended to be used inside a running transaction and therefore should be used by one thread only!
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InvalidationSet.Invalidation
Invalidation object representation.static class
InvalidationSet.InvalidationManagerProcessor
Invalidation processor based onInvalidationManager
.static interface
InvalidationSet.InvalidationProcessor
Interface for performing actual invalidation duringexecuteDelayedInvalidationsGlobally()
,executeDelayedInvalidationsLocally()
orexecuteDelayedRollbackInvalidationsLocally()
.
-
Field Summary
Fields Modifier and Type Field Description static InvalidationSet
EMPTY_SET
Empty immutable invalidation set.
-
Constructor Summary
Constructors Constructor Description InvalidationSet()
InvalidationSet(InvalidationSet.InvalidationProcessor processor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InvalidationSet.Invalidation
addInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a invalidation without dry-running it.static InvalidationSet.Invalidation
createInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Allows to create a standaloneInvalidationSet.Invalidation
instance.InvalidationSet.Invalidation
delayInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a new invalidation and dry-runs it using existing topics and listeners in order to record derived invalidations too.InvalidationSet.Invalidation
delayRollbackInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a invalidation for rollback.void
executeDelayedInvalidationsGlobally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayRollbackInvalidation(Object[], int, int)
.void
executeDelayedInvalidationsLocally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayInvalidation(Object[], int, int)
.void
executeDelayedRollbackInvalidationsLocally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayRollbackInvalidation(Object[], int, int)
.protected InvalidationTarget
getRealInvalidationTarget()
static void
invalidateGlobally(InvalidationSet.Invalidation invalidation)
static void
invalidateGlobally(java.util.Collection<InvalidationSet.Invalidation> invalidations)
static void
invalidateLocally(java.util.Collection<InvalidationSet.Invalidation> invalidations)
boolean
isEmpty()
Tells whether this container has recorded any derived invalidation.boolean
isInvalidated(java.lang.Object[] key)
Checks whether a specific key can be considered to be invalidated according to all recorded derived invalidations.protected void
singleKeyHasBeenInvalidated(java.lang.Object[] key)
-
-
-
Field Detail
-
EMPTY_SET
public static InvalidationSet EMPTY_SET
Empty immutable invalidation set. Will throwUnsupportedOperationException
when calling any update method.
-
-
Constructor Detail
-
InvalidationSet
public InvalidationSet()
-
InvalidationSet
public InvalidationSet(InvalidationSet.InvalidationProcessor processor)
-
-
Method Detail
-
createInvalidation
public static InvalidationSet.Invalidation createInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Allows to create a standaloneInvalidationSet.Invalidation
instance. Use it to execute local or global invalidations viainvalidateGlobally(Collection)
orinvalidateLocally(Collection)
.
-
invalidateGlobally
public static void invalidateGlobally(InvalidationSet.Invalidation invalidation)
-
invalidateGlobally
public static void invalidateGlobally(java.util.Collection<InvalidationSet.Invalidation> invalidations)
-
invalidateLocally
public static void invalidateLocally(java.util.Collection<InvalidationSet.Invalidation> invalidations)
-
executeDelayedInvalidationsGlobally
public void executeDelayedInvalidationsGlobally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayRollbackInvalidation(Object[], int, int)
.These will become effective globally which means that cache invalidation packets will be set to other cluster nodes as well!
-
getRealInvalidationTarget
protected InvalidationTarget getRealInvalidationTarget()
-
executeDelayedInvalidationsLocally
public void executeDelayedInvalidationsLocally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayInvalidation(Object[], int, int)
.They will become effective only locally which means that no cache invalidation packets will be set to other cluster nodes!
-
executeDelayedRollbackInvalidationsLocally
public void executeDelayedRollbackInvalidationsLocally()
Executes all recordedInvalidationSet.Invalidation
objects that have been registered viadelayRollbackInvalidation(Object[], int, int)
.They will become effective only locally which means that no cache invalidation packets will be set to other cluster nodes!
-
delayInvalidation
public InvalidationSet.Invalidation delayInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a new invalidation and dry-runs it using existing topics and listeners in order to record derived invalidations too. As a resultisInvalidated(Object[])
will respect not just this invalidation but also all derived ones.It does not invalidate the real cache here!
-
addInvalidation
public InvalidationSet.Invalidation addInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a invalidation without dry-running it. Therefore derived invalidations will not be recorded thus this has no effect onisInvalidated(Object[])
!
-
delayRollbackInvalidation
public InvalidationSet.Invalidation delayRollbackInvalidation(java.lang.Object[] key, int invalidationTopicDepth, int invalidationType)
Registers a invalidation for rollback. It will not be dry-run, which means that derived invalidations will not be recorded so this has no effect onisInvalidated(Object[])
!
-
singleKeyHasBeenInvalidated
protected void singleKeyHasBeenInvalidated(java.lang.Object[] key)
-
isEmpty
public boolean isEmpty()
Tells whether this container has recorded any derived invalidation.
-
isInvalidated
public boolean isInvalidated(java.lang.Object[] key)
Checks whether a specific key can be considered to be invalidated according to all recorded derived invalidations.
-
-