X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractFrontendHistory.java;h=7c2ddb05b22ba07fba5503615c723b90d38681c4;hb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68;hp=1adca56af2680a32a5c4f68afe39bc1d0f79533d;hpb=db9a673c114febc785fbd324947ac2c3e3095d06;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java index 1adca56af2..7c2ddb05b2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java @@ -13,6 +13,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; +import org.opendaylight.controller.cluster.access.commands.AbstractReadTransactionRequest; import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest; import org.opendaylight.controller.cluster.access.commands.OutOfOrderRequestException; import org.opendaylight.controller.cluster.access.commands.TransactionRequest; @@ -67,14 +68,7 @@ abstract class AbstractFrontendHistory implements Identifiable> maybeReplay = tx.replaySequence(request.getSequence()); @@ -88,6 +82,25 @@ abstract class AbstractFrontendHistory implements Identifiable request, final TransactionIdentifier id) + throws RequestException { + if (request instanceof CommitLocalTransactionRequest) { + LOG.debug("{}: allocating new ready transaction {}", persistenceId(), id); + return createReadyTransaction(id, ((CommitLocalTransactionRequest) request).getModification()); + } + if (request instanceof AbstractReadTransactionRequest) { + if (((AbstractReadTransactionRequest) request).isSnapshotOnly()) { + LOG.debug("{}: allocatint new open snapshot {}", persistenceId(), id); + return createOpenSnapshot(id); + } + } + + LOG.debug("{}: allocating new open transaction {}", persistenceId(), id); + return createOpenTransaction(id); + } + + abstract FrontendTransaction createOpenSnapshot(TransactionIdentifier id) throws RequestException; + abstract FrontendTransaction createOpenTransaction(TransactionIdentifier id) throws RequestException; abstract FrontendTransaction createReadyTransaction(TransactionIdentifier id, DataTreeModification mod)