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
Modifier and TypeFieldDescriptionprotected PrimitiveSparseArray
A data structure for holding partition -> version mapping. -
Constructor Summary
ModifierConstructorDescriptionDefault no-arg constructor.Copy-like constructor based on the providedVersionedPartitions
.protected
DefaultVersionedPartitions
(PrimitiveSparseArray laVersions) Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the partitions being tracked.long
getVersion
(int iPartition) Return the version last received for the given partition.int
hashCode()
iterator()
Returns aVersionedPartitions.VersionedIterator
that allows retrieval of the next element as aprimitive
.void
Restore the contents of a user type instance by reading its state using the specified PofReader object.void
Restore 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()
void
writeExternal
(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.void
writeExternal
(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 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:VersionedPartitions
Return the partitions being tracked.- Specified by:
getPartitions
in interfaceVersionedPartitions
- Returns:
- the partitions being tracked
-
getVersion
public long getVersion(int iPartition) Description copied from interface:VersionedPartitions
Return the version last received for the given partition.- Specified by:
getVersion
in interfaceVersionedPartitions
- Parameters:
iPartition
- the partition in question- Returns:
- the version last received for the given partition
-
iterator
Description copied from interface:VersionedPartitions
Returns aVersionedPartitions.VersionedIterator
that allows retrieval of the next element as aprimitive
. Additionally the current partition can be returned viaVersionedPartitions.Iterator.getPartition()
.- Specified by:
iterator
in interfaceIterable<Long>
- Specified by:
iterator
in 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:ExternalizableLite
Restore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternal
in 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:ExternalizableLite
Save the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternal
in 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:PortableObject
Restore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternal
in 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:PortableObject
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternal
in interfacePortableObject
- Parameters:
out
- the PofWriter to which to write the object's state- Throws:
IOException
- if an I/O error occurs
-