public class DefaultKeyPartitioningStrategy extends ExternalizableHelper implements KeyPartitioningStrategy
ExternalizableHelper.DecoratedMultiBufferReadBuffer, ExternalizableHelper.DefaultObjectStreamFactory, ExternalizableHelper.FormatAwareCompressor, ExternalizableHelper.IntDecoratedObject, ExternalizableHelper.Shielded, ExternalizableHelper.ShieldedDataOutputStream, ExternalizableHelper.ShieldedInputStream, ExternalizableHelper.ShieldedObjectOutputStream, ExternalizableHelper.ShieldedOutputStream, ExternalizableHelper.SimpleXmlBeanClassCache, ExternalizableHelper.Stats, ExternalizableHelper.XmlBeanClassCache
Base.LoggingWriter, Base.StackFrame
KeyPartitioningStrategy.PartitionAwareKey
Modifier and Type | Field and Description |
---|---|
protected PartitionedService |
m_service
The PartitionedService that this strategy is bound to.
|
CONVERTER_FROM_BINARY, CONVERTER_STRIP_INTDECO, CONVERTER_TO_BINARY, DECO_APP_1, DECO_APP_2, DECO_APP_3, DECO_CUSTOM, DECO_EXPIRY, DECO_ID_MAX, DECO_ID_MIN, DECO_JCACHE, DECO_JCACHE_SYNTHETIC, DECO_MEMCACHED, DECO_PUSHREP, DECO_QUEUE_METADATA, DECO_RSVD_1, DECO_RSVD_2, DECO_STORE, DECO_TX, DECO_VALUE, DECO_WLS, EMPTY_BINARY_ARRAY, FMT_B_ARRAY, FMT_BIN_DECO, FMT_BIN_EXT_DECO, FMT_BINARY, FMT_BOOLEAN, FMT_BYTE, FMT_DECIMAL, FMT_DOUBLE, FMT_EXT, FMT_FLOAT, FMT_IDO, FMT_INT, FMT_INTEGER, FMT_LONG, FMT_NONE, FMT_NULL, FMT_OBJ_EXT, FMT_OBJ_SER, FMT_OPT, FMT_OPT_DOUBLE, FMT_OPT_INT, FMT_OPT_LONG, FMT_SHORT, FMT_STRING, FMT_UNKNOWN, FMT_XML_BEAN, FMT_XML_SER, FORCE_RESOLVING_STREAMS, MAX_DECO_HEADER_BYTES, PROPERTY_CONFIG, s_streamfactory, TRINT_DOMAIN_SPAN, TRINT_MAX_VALUE, TRINT_MAX_VARIANCE, USE_POF_STREAMS, USE_XMLBEAN_CLASS_CACHE, XMLBEAN_CLASS_CACHE
Constructor and Description |
---|
DefaultKeyPartitioningStrategy()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static int |
calculateBasePartitionHash(PartitionedService service,
Object oKey)
Determine the partition-hash of the given key.
|
static int |
calculateKeyPartition(PartitionedService service,
Object oKey)
Determine the partition to which the given key should be assigned for
the specified PartitionService, taking into consideration the associations
provided by the service's KeyAssociator.
|
static int |
calculateKeyPartitionHash(PartitionedService service,
Object oKey)
Determine the partition-hash of the given key.
|
static int |
calculatePartition(PartitionedService service,
int nHash)
Return the partition associated with the specified hash value in the
specified PartitionedService.
|
PartitionSet |
getAssociatedPartitions(Object oKey)
Determine the set of partitions that all keys associated with the
specified key are assigned to.
|
int |
getKeyPartition(Object oKey)
Determine the partition to which a particular key should be assigned.
|
void |
init(PartitionedService service)
Initialize the KeyPartitioningStrategy and bind it to the specified
PartitionedService.
|
asBinary, calculatePackedLength, calculatePackedLength, checkObjectInputFilter, convertUTF, decodeExpiry, decorate, decorate, decorate, decorate, decorate, decorateBinary, encodeExpiry, ensureSerializer, extractIntDecoration, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromBinary, fromByteArray, fromByteArray, getClass, getDecoration, getDecoration, getDecorations, getDeltaCompressor, getInputStream, getNewObjectInput, getObjectInput, getObjectOutput, getObjectStreamFactory, getOutputStream, getShieldedOutputStream, getStreamFormat, getUndecorated, getUndecorated, isDecorated, isDecorated, isIntDecorated, isIntDecorated, isResolving, isSerializable, isSerializerCompatible, isVersionCompatible, isVersionCompatible, loadClass, loadResource, main, makeTrint, readBigDecimal, readBigInteger, readBooleanArray, readByteArray, readCollection, readDate, readDoubleArray, readExternalizableLite, readExternalizableLite, readFloatArray, readInt, readInt, readIntArray2d, readLong, readLong, readMap, readMap, readObject, readObject, readSafeUTF, readSafeUTF, readSerializable, readSerializable, readStringArray, readTime, readTimestamp, readTrint, readUnsignedTrint, readUTF, readXmlBean, readXmlSerializable, readXmlSerializable, realize, removeIntDecoration, removeIntDecoration, replace, reportIncompatibleSerializers, setObjectStreamFactory, toBinary, toBinary, toByteArray, toByteArray, toByteArray, toLiteBinary, toLong, undecorate, undecorate, validateBufferSize, writeBigDecimal, writeBigInteger, writeBooleanArray, writeByteArray, writeCollection, writeDate, writeDoubleArray, writeExternalizableLite, writeFloatArray, writeInt, writeInt, writeIntArray2d, writeLong, writeLong, writeMap, writeObject, writeSafeUTF, writeSafeUTF, writeSerializable, writeStringArray, writeTime, writeTimestamp, writeTrint, writeTrint, writeUTF, writeXmlBean, writeXmlSerializable
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, rotateLeft, rotateLeft, rotateLeft, rotateRight, rotateRight, rotateRight, toBitString, toBitString, toBitString, toBytes, toBytes, toBytes, toBytes, toInt, toInt, toLong
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
protected PartitionedService m_service
public DefaultKeyPartitioningStrategy()
public void init(PartitionedService service)
init
in interface KeyPartitioningStrategy
service
- the PartitionedService that this strategy is being
bound topublic int getKeyPartition(Object oKey)
In general, implementations are expected to respect the associations
provided by the service's KeyAssociator in such a way that keys that
return the same associated
key
would be assigned to the same partition. Furthermore,
implementations are also expected to respect explicit
partition-assignments dictated by the KeyPartitioningStrategy.PartitionAwareKey
interface.
Naturally, those two interfaces should not be combined for a given key.
The resulting partition must be in the range [0..N-1], where
N is the value returned from
PartitionedService.getPartitionCount()
.
getKeyPartition
in interface KeyPartitioningStrategy
oKey
- a key in its Object formPartitionedService.getPartitionOwner(int)
public PartitionSet getAssociatedPartitions(Object oKey)
getKeyPartition
method.getAssociatedPartitions
in interface KeyPartitioningStrategy
oKey
- a key in its Object formpublic static int calculateKeyPartition(PartitionedService service, Object oKey)
The resulting partition will be in the range [0..N), where
N is the value returned from the
PartitionedService.getPartitionCount()
method.
service
- the PartitionedServiceoKey
- a key in its original (Object) formatpublic static int calculateKeyPartitionHash(PartitionedService service, Object oKey)
service
- the PartitionedServiceoKey
- a key in its original (Object) formatpublic static int calculateBasePartitionHash(PartitionedService service, Object oKey)
service
- the PartitionedServiceoKey
- a key in its original (Object) formatpublic static int calculatePartition(PartitionedService service, int nHash)
service
- the PartitionedServicenHash
- the hash value