Class CommitTransactionPayload
java.lang.Object
org.opendaylight.controller.cluster.raft.messages.Payload
org.opendaylight.controller.cluster.raft.spi.AbstractStateCommand
org.opendaylight.controller.cluster.raft.messages.IdentifiablePayload<TransactionIdentifier>
org.opendaylight.controller.cluster.datastore.persisted.CommitTransactionPayload
- All Implemented Interfaces:
Serializable
,StateCommand
,StateMachineCommand
,Identifiable<TransactionIdentifier>
,Immutable
@Beta
public final class CommitTransactionPayload
extends IdentifiablePayload<TransactionIdentifier>
implements Serializable
Payload persisted when a transaction commits. It contains the transaction identifier and the
DataTreeCandidate
.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Nested classes/interfaces inherited from interface org.opendaylight.controller.cluster.raft.spi.StateMachineCommand
StateMachineCommand.Reader<T extends StateMachineCommand>, StateMachineCommand.Support<T extends StateMachineCommand>, StateMachineCommand.Writer<T extends StateMachineCommand>
-
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) getCandidate
(ReusableStreamReceiver receiver) int
Return the estimate of serialized size of this payload when passed through serialization.int
size()
Return the estimate of in-memory size of this payload.toString()
protected Object
Return the serialization proxy for this object.Methods inherited from class org.opendaylight.controller.cluster.raft.messages.Payload
toSerialForm
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opendaylight.controller.cluster.raft.spi.StateMachineCommand
toSerialForm
-
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
- Throws:
IOException
-
getCandidate
@NonNullByDefault public CommitTransactionPayload.CandidateTransaction getCandidate(ReusableStreamReceiver receiver) throws IOException - Throws:
IOException
-
getIdentifier
- Specified by:
getIdentifier
in interfaceIdentifiable<TransactionIdentifier>
-
serializedSize
public 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.
-
size
public int size()Description copied from class:Payload
Return the estimate of in-memory size of this payload. -
writeReplace
Description copied from class:Payload
Return the serialization proxy for this object.- Specified by:
writeReplace
in classPayload
- Returns:
- Serialization proxy
-
acquireCandidate
The 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
-