From f8893e0012031a8c623d9da3839e757006878396 Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Thu, 21 May 2015 21:56:21 -0700 Subject: [PATCH] HBASE-13703 ReplicateContext should not be a member of ReplicationSource. --- .../hadoop/hbase/replication/ReplicationEndpoint.java | 2 +- .../hbase/replication/regionserver/ReplicationSource.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java index 978e85326fc..e8a7ddca82e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java @@ -134,7 +134,7 @@ public interface ReplicationEndpoint extends Service { * A context for {@link ReplicationEndpoint#replicate(ReplicateContext)} method. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) - class ReplicateContext { + static class ReplicateContext { List entries; int size; @InterfaceAudience.Private diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java index 4603fa8838d..f7230abc081 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java @@ -131,8 +131,6 @@ public class ReplicationSource extends Thread private ReplicationEndpoint replicationEndpoint; // A filter (or a chain of filters) for the WAL entries. private WALEntryFilter walEntryFilter; - // Context for ReplicationEndpoint#replicate() - private ReplicationEndpoint.ReplicateContext replicateContext; // throttler private ReplicationThrottler throttler; @@ -187,8 +185,6 @@ public class ReplicationSource extends Thread this.peerId = this.replicationQueueInfo.getPeerId(); this.logQueueWarnThreshold = this.conf.getInt("replication.source.log.queue.warn", 2); this.replicationEndpoint = replicationEndpoint; - - this.replicateContext = new ReplicationEndpoint.ReplicateContext(); } private void decorateConf() { @@ -689,6 +685,8 @@ public class ReplicationSource extends Thread this.throttler.resetStartTick(); } } + // create replicateContext here, so the entries can be GC'd upon return from this call stack + ReplicationEndpoint.ReplicateContext replicateContext = new ReplicationEndpoint.ReplicateContext(); replicateContext.setEntries(entries).setSize(currentSize); long startTimeNs = System.nanoTime();