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%2Fdatabroker%2FClientBackedTransactionChain.java;h=36d1b5d575a3c01353112465a2fc41c78d670434;hb=17e4759c7561e09786a22210e43b5b32db45149e;hp=db30372676c43057749ae11d157901eaa77978d3;hpb=5a0edd493bafc365647bc6311b4b7da86a78645d;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransactionChain.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransactionChain.java index db30372676..36d1b5d575 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransactionChain.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransactionChain.java @@ -35,24 +35,26 @@ final class ClientBackedTransactionChain implements DOMStoreTransactionChain { private final Map, Boolean> openSnapshots = new WeakHashMap<>(); private final ClientLocalHistory history; + private final boolean debugAllocation; - ClientBackedTransactionChain(final ClientLocalHistory history) { + ClientBackedTransactionChain(final ClientLocalHistory history, final boolean debugAllocation) { this.history = Preconditions.checkNotNull(history); + this.debugAllocation = debugAllocation; } @Override public DOMStoreReadTransaction newReadOnlyTransaction() { - return new ClientBackedReadTransaction(createSnapshot(), this); + return new ClientBackedReadTransaction(createSnapshot(), this, allocationContext()); } @Override public DOMStoreReadWriteTransaction newReadWriteTransaction() { - return new ClientBackedReadWriteTransaction(createTransaction()); + return new ClientBackedReadWriteTransaction(createTransaction(), allocationContext()); } @Override public DOMStoreWriteTransaction newWriteOnlyTransaction() { - return new ClientBackedWriteTransaction(createTransaction()); + return new ClientBackedWriteTransaction(createTransaction(), allocationContext()); } @Override @@ -86,6 +88,10 @@ final class ClientBackedTransactionChain implements DOMStoreTransactionChain { } } + private Throwable allocationContext() { + return debugAllocation ? new Throwable("allocated at") : null; + } + private synchronized > T recordSnapshot(final T snapshot) { openSnapshots.put(snapshot, Boolean.TRUE); return snapshot;