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 class CommitTransactionPayload extends IdentifiablePayload<TransactionIdentifier> implements Serializable
Payload persisted when a transaction commits. It contains the transaction identifier and theDataTreeCandidate
- Author:
- Robert Varga
- See Also:
- Serialized Form
-
-
Method Summary
-
-
-
Method Detail
-
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
public TransactionIdentifier 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 IOException
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
-
writeReplace
protected final Object writeReplace()
Description copied from class:Payload
Return the serialization proxy for this object.- Specified by:
writeReplace
in classPayload
- Returns:
- Serialization proxy
-
-