Class CommitTransactionPayload
java.lang.Object
org.opendaylight.controller.cluster.raft.messages.Payload
org.opendaylight.controller.cluster.raft.messages.IdentifiablePayload<TransactionIdentifier>
org.opendaylight.controller.cluster.datastore.persisted.CommitTransactionPayload
- All Implemented Interfaces:
Serializable
,Identifiable<TransactionIdentifier>
@Beta
public abstract sealed class CommitTransactionPayload
extends IdentifiablePayload<TransactionIdentifier>
implements Serializable
Payload persisted when a transaction commits. It contains the transaction identifier and the
DataTreeCandidate
- Author:
- Robert Varga
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionThe cached candidate needs to be cleared after it is done applying to the DataTree, otherwise it would be keeping deserialized in memory which are not needed anymore leading to wasted memory.static @NonNull CommitTransactionPayload
create
(TransactionIdentifier transactionId, DataTreeCandidate candidate) static @NonNull CommitTransactionPayload
create
(TransactionIdentifier transactionId, DataTreeCandidate candidate, PayloadVersion version) static @NonNull CommitTransactionPayload
create
(TransactionIdentifier transactionId, DataTreeCandidate candidate, PayloadVersion version, int initialSerializedBufferCapacity) final @NonNull Map.Entry<TransactionIdentifier,
DataTreeCandidateInputOutput.DataTreeCandidateWithVersion> getCandidate
(ReusableStreamReceiver receiver) final int
Return the estimate of serialized size of this payload when passed through serialization.final String
toString()
final Object
Return the serialization proxy for this object.
-
Method Details
-
create
public static @NonNull CommitTransactionPayload create(TransactionIdentifier transactionId, DataTreeCandidate candidate, PayloadVersion version, int initialSerializedBufferCapacity) throws IOException - Throws:
IOException
-
create
public static @NonNull CommitTransactionPayload create(TransactionIdentifier transactionId, DataTreeCandidate candidate, PayloadVersion version) throws IOException - Throws:
IOException
-
create
public static @NonNull CommitTransactionPayload create(TransactionIdentifier transactionId, DataTreeCandidate candidate) throws IOException - Throws:
IOException
-
getCandidate
public @NonNull Map.Entry<TransactionIdentifier,DataTreeCandidateInputOutput.DataTreeCandidateWithVersion> getCandidate() throws IOException- Throws:
IOException
-
getCandidate
public final @NonNull Map.Entry<TransactionIdentifier,DataTreeCandidateInputOutput.DataTreeCandidateWithVersion> getCandidate(ReusableStreamReceiver receiver) throws IOException - Throws:
IOException
-
getIdentifier
- Specified by:
getIdentifier
in interfaceIdentifiable<TransactionIdentifier>
-
serializedSize
public final int serializedSize()Description copied from class:Payload
Return the estimate of serialized size of this payload when passed through serialization. The estimate needs to be reasonably accurate and should err on the side of caution and report a slightly-higher size in face of uncertainty.- Specified by:
serializedSize
in classPayload
- Returns:
- An estimate of serialized size.
-
acquireCandidate
public Map.Entry<TransactionIdentifier,DataTreeCandidateInputOutput.DataTreeCandidateWithVersion> acquireCandidate() throws IOExceptionThe cached candidate needs to be cleared after it is done applying to the DataTree, otherwise it would be keeping deserialized in memory which are not needed anymore leading to wasted memory. This lets the payload know that this was the last time the candidate was needed ant it is safe to be cleared.- Throws:
IOException
-
toString
-
writeReplace
Description copied from class:Payload
Return the serialization proxy for this object.- Specified by:
writeReplace
in classPayload
- Returns:
- Serialization proxy
-