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 PrimitiveSparseArray
m_laVersions
A 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
.protected
DefaultVersionedPartitions(PrimitiveSparseArray laVersions)
Create a DefaultVersionedPartitions instance based on the providedPrimitiveSparseArray
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
VersionedPartitions.Iterator<Integer>
getPartitions()
Return the partitions being tracked.long
getVersion(int iPartition)
Return the version last received for the given partition.int
hashCode()
VersionedPartitions.VersionedIterator
iterator()
Returns aVersionedPartitions.VersionedIterator
that allows retrieval of the next element as aprimitive
.void
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using the specified PofReader object.void
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object.DefaultVersionedPartitions
setPartitionVersion(int iPart, long lVersion)
Set the partition version.String
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 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: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
public VersionedPartitions.VersionedIterator 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
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: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 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: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
public void readExternal(PofReader in) throws IOException
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
public void writeExternal(PofWriter out) throws IOException
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
-
-