X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcds-access-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fcommands%2FCommitLocalTransactionRequest.java;h=adef0c31bc022775889ad6d123954f6be955758d;hp=1f739515c99c6f0c6eb1c4e960a97ebc4f3b113f;hb=HEAD;hpb=c9d61ee66367d819319bb8ccfa9f9b0555264d86 diff --git a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/CommitLocalTransactionRequest.java b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/CommitLocalTransactionRequest.java index 1f739515c9..7a3f771b47 100644 --- a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/CommitLocalTransactionRequest.java +++ b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/CommitLocalTransactionRequest.java @@ -7,33 +7,52 @@ */ package org.opendaylight.controller.cluster.access.commands; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorRef; -import com.google.common.annotations.Beta; import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Preconditions; -import javax.annotation.Nonnull; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ObjectStreamException; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; +import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification; /** * Request to commit a local transaction. Since local transactions do not introduce state on the backend until they * are ready, this message carries a complete set of modifications. - * - * @author Robert Varga */ -@Beta -public final class CommitLocalTransactionRequest extends AbstractLocalTransactionRequest { +public final class CommitLocalTransactionRequest + extends AbstractLocalTransactionRequest { + @java.io.Serial private static final long serialVersionUID = 1L; + private final DataTreeModification mod; + private final Exception delayedFailure; private final boolean coordinated; - public CommitLocalTransactionRequest(final @Nonnull TransactionIdentifier identifier, - final @Nonnull ActorRef replyTo, final @Nonnull DataTreeModification mod, final boolean coordinated) { - super(identifier, replyTo); - this.mod = Preconditions.checkNotNull(mod); + public CommitLocalTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence, + final @NonNull ActorRef replyTo, final @NonNull DataTreeModification mod, + final @Nullable Exception delayedFailure, final boolean coordinated) { + super(identifier, sequence, replyTo); + this.mod = requireNonNull(mod); + this.delayedFailure = delayedFailure; this.coordinated = coordinated; } + /** + * Return the delayed error detected on the frontend. If this error is present, it will be reported as the result + * of the first step of the commit process. + * + * @return Delayed failure, if present. + */ + public Optional getDelayedFailure() { + return Optional.ofNullable(delayedFailure); + } + public DataTreeModification getModification() { return mod; } @@ -52,6 +71,22 @@ public final class CommitLocalTransactionRequest extends AbstractLocalTransactio @Override protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) { - return super.addToStringAttributes(toStringHelper).add("coordinated", coordinated); + return super.addToStringAttributes(toStringHelper).add("coordinated", coordinated) + .add("delayedError", delayedFailure); + } + + @java.io.Serial + private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException { + throwNSE(); + } + + @java.io.Serial + private void readObjectNoData() throws ObjectStreamException { + throwNSE(); + } + + @java.io.Serial + private void writeObject(final ObjectOutputStream stream) throws IOException { + throwNSE(); } -} \ No newline at end of file +}