From 89274c9c31212a1d0f13aeb90384442e72221029 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Mon, 15 Feb 2016 23:45:36 -0500 Subject: [PATCH] Bug 4627: Fix premature RO tx cleanup For the RO tx PhantomReference cleanup mechanism, modified RemoteTransactionContextSupport to pass the front-end client TransactionProxy instance as the referent to the FinalizablePhantomReference. Previously we were passing the RemoteTransactionContextSupport instance which is only reachable via a hard reference until the primary shard actor is obtained and thus may be eligible for GC while the TransactionProxy is still in use. Change-Id: Ib2808b4ba8113a5722f9ee422434a89adaf775fe Signed-off-by: Tom Pantelis --- .../datastore/RemoteTransactionContextSupport.java | 2 +- .../cluster/datastore/TransactionContextCleanup.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java index e160367a1e..4a031fa916 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java @@ -253,7 +253,7 @@ final class RemoteTransactionContextSupport { transactionActor, getActorContext(), remoteTransactionVersion, transactionContextWrapper.getLimiter()); if(parent.getType() == TransactionType.READ_ONLY) { - TransactionContextCleanup.track(this, ret); + TransactionContextCleanup.track(parent, ret); } return ret; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextCleanup.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextCleanup.java index 8998f5c74c..865cc60edb 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextCleanup.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionContextCleanup.java @@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory; * to the old generation space and thus should be cleaned up in a timely manner as the GC * runs on the young generation (eden, swap1...) space much more frequently. */ -final class TransactionContextCleanup extends FinalizablePhantomReference { +final class TransactionContextCleanup extends FinalizablePhantomReference { private static final Logger LOG = LoggerFactory.getLogger(TransactionContextCleanup.class); /** * Used to enqueue the PhantomReferences for read-only TransactionProxy instances. The @@ -42,12 +42,12 @@ final class TransactionContextCleanup extends FinalizablePhantomReference