public interface SegmentSpecificCommand
If a command implements this interface, the command MUST ensure that it is initialized properly to
always return a number 0 or greater when invoking getSegment()
.
Modifier and Type | Method and Description |
---|---|
static int |
extractSegment(ReplicableCommand command,
Object key,
KeyPartitioner keyPartitioner)
Utility to extract the segment from a given command that may be a
SegmentSpecificCommand . |
int |
getSegment()
Returns the segment that this key maps to.
|
int getSegment()
static int extractSegment(ReplicableCommand command, Object key, KeyPartitioner keyPartitioner)
SegmentSpecificCommand
. If the
command is a SegmentSpecificCommand
, it will immediately return the value from getSegment()
.
Otherwise it will return the result from invoking KeyPartitioner.getSegment(Object)
passing the provided key.command
- the command to extract the segment fromkey
- the key the segment belongs tokeyPartitioner
- the partitioner to calculate the segment of the keyCopyright © 2021 JBoss by Red Hat. All rights reserved.