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 ofVersionedPartitions,- Since:
- 21.06
- Author:
- hr 2021.02.17
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.net.partition.VersionedPartitions
VersionedPartitions.Iterator<T>, VersionedPartitions.VersionedIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected PrimitiveSparseArraym_laVersionsA data structure for holding partition -> version mapping.
-
Constructor Summary
Constructors Modifier Constructor Description DefaultVersionedPartitions()Default no-arg constructor.DefaultVersionedPartitions(VersionedPartitions versions)Copy-like constructor based on the providedVersionedPartitions.protectedDefaultVersionedPartitions(PrimitiveSparseArray laVersions)Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)VersionedPartitions.Iterator<Integer>getPartitions()Return the partitions being tracked.longgetVersion(int iPartition)Return the version last received for the given partition.inthashCode()VersionedPartitions.VersionedIteratoriterator()Returns aVersionedPartitions.VersionedIteratorthat allows retrieval of the next element as aprimitive.voidreadExternal(PofReader in)Restore the contents of a user type instance by reading its state using the specified PofReader object.voidreadExternal(DataInput in)Restore the contents of this object by loading the object's state from the passed DataInput object.DefaultVersionedPartitionssetPartitionVersion(int iPart, long lVersion)Set the partition version.StringtoString()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, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
m_laVersions
protected PrimitiveSparseArray m_laVersions
A data structure for holding partition -> version mapping.
-
-
Constructor Detail
-
DefaultVersionedPartitions
public DefaultVersionedPartitions()
Default no-arg constructor.
-
DefaultVersionedPartitions
public DefaultVersionedPartitions(VersionedPartitions versions)
Copy-like constructor based on the providedVersionedPartitions.- Parameters:
versions- the VersionedPartitions to copy / clone from
-
DefaultVersionedPartitions
protected DefaultVersionedPartitions(PrimitiveSparseArray laVersions)
Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray.- Parameters:
laVersions- a PrimitiveSparseArray to base this VersionedPartitions implementation on
-
-
Method Detail
-
getPartitions
public VersionedPartitions.Iterator<Integer> 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
public VersionedPartitions.VersionedIterator 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
public DefaultVersionedPartitions setPartitionVersion(int iPart, long lVersion)
Set the partition version.- Parameters:
iPart- the partitionlVersion- the version
-
readExternal
public void readExternal(DataInput in) throws IOException
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 occursNotActiveException- if the object is not in its initial state, and therefore cannot be deserialized into
-
writeExternal
public void writeExternal(DataOutput out) throws IOException
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
public void readExternal(PofReader in) throws IOException
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
public void writeExternal(PofWriter out) throws IOException
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
-
-