Package org.infinispan.commands.write
Class InvalidateL1Command
- java.lang.Object
-
- org.infinispan.commands.AbstractFlagAffectedCommand
-
- org.infinispan.commands.AbstractTopologyAffectedCommand
-
- org.infinispan.commands.write.InvalidateCommand
-
- org.infinispan.commands.write.InvalidateL1Command
-
- All Implemented Interfaces:
FlagAffectedCommand
,ReplicableCommand
,TopologyAffectedCommand
,VisitableCommand
,WriteCommand
,RemoteLockCommand
public class InvalidateL1Command extends InvalidateCommand
Invalidates an entry in a L1 cache (used with DIST mode)- Since:
- 4.0
- Author:
- Manik Surtani, Mircea.Markus@jboss.com
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMMAND_ID
-
Fields inherited from class org.infinispan.commands.write.InvalidateCommand
commandInvocationId, keys, notifier
-
-
Constructor Summary
Constructors Constructor Description InvalidateL1Command()
InvalidateL1Command(DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, Collection<Object> keys, CommandInvocationId commandInvocationId)
InvalidateL1Command(DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, CommandInvocationId commandInvocationId, Object... keys)
InvalidateL1Command(Address writeOrigin, DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, Collection<Object> keys, CommandInvocationId commandInvocationId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
acceptVisitor(InvocationContext ctx, Visitor visitor)
Accept a visitor, and return the result of accepting this visitor.byte
getCommandId()
Used by marshallers to convert this command into an id for streaming.Collection<?>
getKeysToLock()
It returns aCollection
with the keys to be lock.void
init(DistributionManager dm, CacheNotifier n, DataContainer dc)
boolean
isCausedByALocalWrite(Address address)
Returns true if the write that caused the invalidation was performed on this node.Object
perform(InvocationContext ctx)
Performs an invalidation on a specified entryvoid
readFrom(ObjectInput input)
Reads this instance from the stream written byReplicableCommand.writeTo(ObjectOutput)
.void
setKeys(Object[] keys)
String
toString()
void
writeTo(ObjectOutput output)
Writes this instance to theObjectOutput
.-
Methods inherited from class org.infinispan.commands.write.InvalidateCommand
canBlock, equals, fail, getAffectedKeys, getCommandInvocationId, getKeyLockOwner, getKeys, getValueMatcher, hashCode, hasSkipLocking, hasZeroLockAcquisition, init, isConditional, isReturnValueExpected, isSuccessful, loadType, notify, setValueMatcher
-
Methods inherited from class org.infinispan.commands.AbstractTopologyAffectedCommand
getTopologyId, setTopologyId
-
Methods inherited from class org.infinispan.commands.AbstractFlagAffectedCommand
getFlagsBitSet, hasSameFlags, printFlags, setFlagsBitSet
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.infinispan.commands.FlagAffectedCommand
addFlag, addFlags, addFlags, getFlags, getFlagsBitSet, hasAnyFlag, hasFlag, setFlags, setFlagsBitSet
-
Methods inherited from interface org.infinispan.commands.ReplicableCommand
invoke, invokeAsync, setOrigin
-
Methods inherited from interface org.infinispan.commands.TopologyAffectedCommand
getTopologyId, setTopologyId
-
Methods inherited from interface org.infinispan.commands.VisitableCommand
ignoreCommandOnStatus, shouldInvoke
-
Methods inherited from interface org.infinispan.commands.write.WriteCommand
isWriteOnly, updateStatusFromRemoteResponse
-
-
-
-
Field Detail
-
COMMAND_ID
public static final int COMMAND_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InvalidateL1Command
public InvalidateL1Command()
-
InvalidateL1Command
public InvalidateL1Command(DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, CommandInvocationId commandInvocationId, Object... keys)
-
InvalidateL1Command
public InvalidateL1Command(DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, Collection<Object> keys, CommandInvocationId commandInvocationId)
-
InvalidateL1Command
public InvalidateL1Command(Address writeOrigin, DataContainer dc, DistributionManager dm, CacheNotifier notifier, long flagsBitSet, Collection<Object> keys, CommandInvocationId commandInvocationId)
-
-
Method Detail
-
getCommandId
public byte getCommandId()
Description copied from interface:ReplicableCommand
Used by marshallers to convert this command into an id for streaming.- Specified by:
getCommandId
in interfaceReplicableCommand
- Overrides:
getCommandId
in classInvalidateCommand
- Returns:
- the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.
-
init
public void init(DistributionManager dm, CacheNotifier n, DataContainer dc)
-
perform
public Object perform(InvocationContext ctx) throws Throwable
Description copied from class:InvalidateCommand
Performs an invalidation on a specified entry- Specified by:
perform
in interfaceReplicableCommand
- Specified by:
perform
in interfaceVisitableCommand
- Overrides:
perform
in classInvalidateCommand
- Parameters:
ctx
- invocation context- Returns:
- null
- Throws:
Throwable
- in the event of problems.
-
setKeys
public void setKeys(Object[] keys)
-
getKeysToLock
public Collection<?> getKeysToLock()
Description copied from interface:RemoteLockCommand
It returns aCollection
with the keys to be lock.It may return an empty collection if no keys needs to be locked independently of the return value of
RemoteLockCommand.hasSkipLocking()
. It may contains duplicated keys andnull
is not a valid return value.- Specified by:
getKeysToLock
in interfaceRemoteLockCommand
- Overrides:
getKeysToLock
in classInvalidateCommand
- Returns:
- a
Collection
of keys to lock.
-
writeTo
public void writeTo(ObjectOutput output) throws IOException
Description copied from interface:ReplicableCommand
Writes this instance to theObjectOutput
.- Specified by:
writeTo
in interfaceReplicableCommand
- Overrides:
writeTo
in classInvalidateCommand
- Parameters:
output
- the stream.- Throws:
IOException
- if an error occurred during the I/O.
-
readFrom
public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException
Description copied from interface:ReplicableCommand
Reads this instance from the stream written byReplicableCommand.writeTo(ObjectOutput)
.- Specified by:
readFrom
in interfaceReplicableCommand
- Overrides:
readFrom
in classInvalidateCommand
- Parameters:
input
- the stream to read.- Throws:
IOException
- if an error occurred during the I/O.ClassNotFoundException
- if it tries to load an undefined class.
-
acceptVisitor
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
Description copied from interface:VisitableCommand
Accept a visitor, and return the result of accepting this visitor.- Specified by:
acceptVisitor
in interfaceVisitableCommand
- Overrides:
acceptVisitor
in classInvalidateCommand
- Parameters:
ctx
- invocation contextvisitor
- visitor to accept- Returns:
- arbitrary return value
- Throws:
Throwable
- in the event of problems
-
toString
public String toString()
- Overrides:
toString
in classInvalidateCommand
-
isCausedByALocalWrite
public boolean isCausedByALocalWrite(Address address)
Returns true if the write that caused the invalidation was performed on this node. More formal, if a put(k) happens on node A and ch(A)={B}, then an invalidation message might be multicasted by B to all cluster members including A. This method returns true if and only if the node where it is invoked is A.
-
-