Package org.infinispan.commands.read
Class AbstractDataCommand
- java.lang.Object
-
- org.infinispan.commands.read.AbstractDataCommand
-
- All Implemented Interfaces:
DataCommand
,FlagAffectedCommand
,ReplicableCommand
,SegmentSpecificCommand
,TopologyAffectedCommand
,VisitableCommand
- Direct Known Subclasses:
AbstractDataWriteCommand
,GetCacheEntryCommand
,GetKeyValueCommand
,ReadOnlyKeyCommand
public abstract class AbstractDataCommand extends Object implements DataCommand, SegmentSpecificCommand
- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Sanne Grinovero <sanne@hibernate.org> (C) 2011 Red Hat Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.commands.VisitableCommand
VisitableCommand.LoadType
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDataCommand()
protected
AbstractDataCommand(Object key, int segment, long flagsBitSet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBlock()
If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool.boolean
equals(Object obj)
long
getFlagsBitSet()
Object
getKey()
int
getSegment()
Returns the segment that this key maps to.int
getTopologyId()
int
hashCode()
boolean
isReturnValueExpected()
If true, a return value will be provided when performed remotely.protected String
printFlags()
void
setFlagsBitSet(long bitSet)
Set the flags, replacing any existing flags.void
setKey(Object key)
void
setTopologyId(int topologyId)
String
toString()
-
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, hasAllFlags, hasAnyFlag, hasFlag, setFlags
-
Methods inherited from interface org.infinispan.commands.ReplicableCommand
getCommandId, invoke, invokeAsync, isSuccessful, readFrom, setOrigin, writeTo
-
Methods inherited from interface org.infinispan.commands.VisitableCommand
acceptVisitor, ignoreCommandOnStatus, loadType, perform, shouldInvoke
-
-
-
-
Field Detail
-
key
protected Object key
-
segment
protected int segment
-
-
Constructor Detail
-
AbstractDataCommand
protected AbstractDataCommand(Object key, int segment, long flagsBitSet)
-
AbstractDataCommand
protected AbstractDataCommand()
-
-
Method Detail
-
getSegment
public int getSegment()
Description copied from interface:SegmentSpecificCommand
Returns the segment that this key maps to. This must always return a number 0 or larger.- Specified by:
getSegment
in interfaceSegmentSpecificCommand
- Returns:
- the segment of the key
-
getTopologyId
public int getTopologyId()
- Specified by:
getTopologyId
in interfaceTopologyAffectedCommand
-
setTopologyId
public void setTopologyId(int topologyId)
- Specified by:
setTopologyId
in interfaceTopologyAffectedCommand
-
getFlagsBitSet
public long getFlagsBitSet()
- Specified by:
getFlagsBitSet
in interfaceFlagAffectedCommand
- Returns:
- The command flags. Flags can be modified with
FlagAffectedCommand.setFlagsBitSet(long)
,FlagAffectedCommand.addFlags(long)
andFlagAffectedCommand.addFlags(Set)
methods.
-
setFlagsBitSet
public void setFlagsBitSet(long bitSet)
Description copied from interface:FlagAffectedCommand
Set the flags, replacing any existing flags.- Specified by:
setFlagsBitSet
in interfaceFlagAffectedCommand
-
getKey
public Object getKey()
- Specified by:
getKey
in interfaceDataCommand
-
setKey
public void setKey(Object key)
-
isReturnValueExpected
public boolean isReturnValueExpected()
Description copied from interface:ReplicableCommand
If true, a return value will be provided when performed remotely. Otherwise, a remoteResponseGenerator
may choose to simply return null to save on marshalling costs.- Specified by:
isReturnValueExpected
in interfaceReplicableCommand
- Returns:
- true or false
-
canBlock
public boolean canBlock()
Description copied from interface:ReplicableCommand
If true, the command is processed asynchronously in a thread provided by an Infinispan thread pool. Otherwise, the command is processed directly in the JGroups thread. This feature allows to avoid keep a JGroups thread busy that can originate discard of messages and retransmissions. So, the commands that can block (waiting for some state, acquiring locks, etc.) should return true.- Specified by:
canBlock
in interfaceReplicableCommand
- Returns:
true
if the command can block/wait,false
otherwise
-
printFlags
protected final String printFlags()
-
-