Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG-8704: rework seal mechanics to not wait during replay
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
databroker
/
actors
/
dds
/
ClientTransaction.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
index 334ab71d585d2f4295b8d78b2e5094fff839973e..efa503a90c0f3a8c909222a0c13d624a50111ba3 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
@@
-13,8
+13,11
@@
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Collection;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Collection;
+import javax.annotation.Nonnull;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.mdsal.common.api.ReadFailedException;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeCursor;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@
-50,13
+53,14
@@
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
* @author Robert Varga
*/
@Beta
* @author Robert Varga
*/
@Beta
-public final class ClientTransaction extends AbstractClientHandle<AbstractProxyTransaction> {
+public class ClientTransaction extends AbstractClientHandle<AbstractProxyTransaction> {
+
+ private ClientTransactionCursor cursor;
ClientTransaction(final AbstractClientHistory parent, final TransactionIdentifier transactionId) {
super(parent, transactionId);
}
ClientTransaction(final AbstractClientHistory parent, final TransactionIdentifier transactionId) {
super(parent, transactionId);
}
-
private AbstractProxyTransaction createProxy(final Long shard) {
return parent().createTransactionProxy(getIdentifier(), shard);
}
private AbstractProxyTransaction createProxy(final Long shard) {
return parent().createTransactionProxy(getIdentifier(), shard);
}
@@
-65,6
+69,12
@@
public final class ClientTransaction extends AbstractClientHandle<AbstractProxyT
return ensureProxy(path, this::createProxy);
}
return ensureProxy(path, this::createProxy);
}
+ public DOMDataTreeWriteCursor openCursor() {
+ Preconditions.checkState(cursor == null, "Transaction %s has open cursor", getIdentifier());
+ cursor = new ClientTransactionCursor(this);
+ return cursor;
+ }
+
public CheckedFuture<Boolean, ReadFailedException> exists(final YangInstanceIdentifier path) {
return ensureTransactionProxy(path).exists(path);
}
public CheckedFuture<Boolean, ReadFailedException> exists(final YangInstanceIdentifier path) {
return ensureTransactionProxy(path).exists(path);
}
@@
-107,4
+117,10
@@
public final class ClientTransaction extends AbstractClientHandle<AbstractProxyT
return parent().onTransactionReady(this, cohort);
}
return parent().onTransactionReady(this, cohort);
}
+
+ void closeCursor(@Nonnull final DOMDataTreeCursor cursor) {
+ if (cursor.equals(this.cursor)) {
+ this.cursor = null;
+ }
+ }
}
}