X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fcds-access-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fcommands%2FClosedTransactionException.java;fp=opendaylight%2Fmd-sal%2Fcds-access-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Faccess%2Fcommands%2FClosedTransactionException.java;h=ece472056473df653610cb9c51fe1e9918c28c55;hb=2634ed7138a343f051ff6452ccc7edd3abfc0c3a;hp=0000000000000000000000000000000000000000;hpb=d65a77b0a3dc7a10952b1e1ecf2ee69c925530bb;p=controller.git diff --git a/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionException.java b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionException.java new file mode 100644 index 0000000000..ece4720564 --- /dev/null +++ b/opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ClosedTransactionException.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.access.commands; + +import com.google.common.annotations.Beta; +import org.opendaylight.controller.cluster.access.concepts.RequestException; + +/** + * A {@link RequestException} indicating that the backend has received a request for a transaction which has already + * been closed, either via a successful commit or abort (which is indicated via {@link #isSuccessful()}. This can + * happen if the corresponding journal record is replicated, but the message to the frontend gets lost and the backed + * leader moved before the frontend retried the corresponding request. + * + * @author Robert Varga + */ +@Beta +public final class ClosedTransactionException extends RequestException { + private static final long serialVersionUID = 1L; + + private final boolean successful; + + public ClosedTransactionException(final boolean successful) { + super("Transaction has been " + (successful ? "committed" : "aborted")); + this.successful = successful; + } + + @Override + public boolean isRetriable() { + return false; + } + + public boolean isSuccessful() { + return successful; + } +}