Package com.tangosol.net.partition
Class DefaultVersionedPartitions
java.lang.Object
com.tangosol.net.partition.DefaultVersionedPartitions
- All Implemented Interfaces:
ExternalizableLite,PortableObject,VersionedPartitions,Serializable,Iterable<Long>
public class DefaultVersionedPartitions
extends Object
implements VersionedPartitions, ExternalizableLite, PortableObject
Default implementation of
VersionedPartitions,- Since:
- 21.06
- Author:
- hr 2021.02.17
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tangosol.net.partition.VersionedPartitions
VersionedPartitions.Iterator<T>, VersionedPartitions.VersionedIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PrimitiveSparseArrayA data structure for holding partition -> version mapping. -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefault no-arg constructor.Copy-like constructor based on the providedVersionedPartitions.protectedDefaultVersionedPartitions(PrimitiveSparseArray laVersions) Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn the partitions being tracked.longgetVersion(int iPartition) Return the version last received for the given partition.inthashCode()iterator()Returns aVersionedPartitions.VersionedIteratorthat allows retrieval of the next element as aprimitive.voidRestore the contents of a user type instance by reading its state using the specified PofReader object.voidRestore the contents of this object by loading the object's state from the passed DataInput object.setPartitionVersion(int iPart, long lVersion) Set the partition version.toString()voidwriteExternal(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.voidwriteExternal(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
m_laVersions
A data structure for holding partition -> version mapping.
-
-
Constructor Details
-
DefaultVersionedPartitions
public DefaultVersionedPartitions()Default no-arg constructor. -
DefaultVersionedPartitions
Copy-like constructor based on the providedVersionedPartitions.- Parameters:
versions- the VersionedPartitions to copy / clone from
-
DefaultVersionedPartitions
Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray.- Parameters:
laVersions- a PrimitiveSparseArray to base this VersionedPartitions implementation on
-
-
Method Details
-
getPartitions
Description copied from interface:VersionedPartitionsReturn the partitions being tracked.- Specified by:
getPartitionsin interfaceVersionedPartitions- Returns:
- the partitions being tracked
-
getVersion
public long getVersion(int iPartition) Description copied from interface:VersionedPartitionsReturn the version last received for the given partition.- Specified by:
getVersionin interfaceVersionedPartitions- Parameters:
iPartition- the partition in question- Returns:
- the version last received for the given partition
-
iterator
Description copied from interface:VersionedPartitionsReturns aVersionedPartitions.VersionedIteratorthat allows retrieval of the next element as aprimitive. Additionally the current partition can be returned viaVersionedPartitions.Iterator.getPartition().- Specified by:
iteratorin interfaceIterable<Long>- Specified by:
iteratorin interfaceVersionedPartitions- Returns:
- a versioned iterator to return the partition and version
-
setPartitionVersion
Set the partition version.- Parameters:
iPart- the partitionlVersion- the version
-
equals
-
hashCode
public int hashCode() -
toString
-
readExternal
Description copied from interface:ExternalizableLiteRestore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin interfaceExternalizableLite- Parameters:
in- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException- if an I/O exception occurs
-
writeExternal
Description copied from interface:ExternalizableLiteSave the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
readExternal
Description copied from interface:PortableObjectRestore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternalin interfacePortableObject- Parameters:
in- the PofReader from which to read the object's state- Throws:
IOException- if an I/O error occurs
-
writeExternal
Description copied from interface:PortableObjectSave the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternalin interfacePortableObject- Parameters:
out- the PofWriter to which to write the object's state- Throws:
IOException- if an I/O error occurs
-