phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [1/2] git commit: PHOENIX-1364 Fix resource leaks in various classes (Ted Yu)
Date Tue, 21 Oct 2014 18:28:59 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 677e34cae -> b8526707b


PHOENIX-1364 Fix resource leaks in various classes (Ted Yu)


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/94a72a29
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/94a72a29
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/94a72a29

Branch: refs/heads/master
Commit: 94a72a2988bd837a8584883043a9f407f208c43e
Parents: 677e34c
Author: James Taylor <jtaylor@salesforce.com>
Authored: Tue Oct 21 11:26:21 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Tue Oct 21 11:33:18 2014 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/hbase/index/Indexer.java | 10 ++++++++--
 .../java/org/apache/phoenix/trace/TraceMetricSource.java  |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a72a29/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
index c170c89..d55dfbf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
@@ -68,6 +68,7 @@ import org.apache.phoenix.trace.TracingCompat;
 import org.apache.phoenix.trace.util.NullSpan;
 import org.cloudera.htrace.Span;
 import org.cloudera.htrace.Trace;
+import org.cloudera.htrace.TraceScope;
 
 import com.google.common.collect.Multimap;
 
@@ -264,7 +265,8 @@ public class Indexer extends BaseRegionObserver {
     }
 
         // get the current span, or just use a null-span to avoid a bunch of if statements
-        Span current = Trace.startSpan("Starting to build index updates").getSpan();
+    TraceScope scope = Trace.startSpan("Starting to build index updates");
+        Span current = scope.getSpan();
         if (current == null) {
             current = NullSpan.INSTANCE;
         }
@@ -281,6 +283,7 @@ public class Indexer extends BaseRegionObserver {
 
         // close the span
         current.stop();
+        scope.close();
   }
 
   private class MultiMutation extends Mutation {
@@ -422,7 +425,8 @@ public class Indexer extends BaseRegionObserver {
     }
 
         // get the current span, or just use a null-span to avoid a bunch of if statements
-        Span current = Trace.startSpan("Completing index writes").getSpan();
+    TraceScope scope = Trace.startSpan("Completing index writes");
+        Span current = scope.getSpan();
         if (current == null) {
             current = NullSpan.INSTANCE;
         }
@@ -439,6 +443,7 @@ public class Indexer extends BaseRegionObserver {
      */
     if (ikv == null) {
             current.stop();
+            scope.close();
       return;
     }
 
@@ -468,6 +473,7 @@ public class Indexer extends BaseRegionObserver {
                 // finish the span
 
                 current.stop();
+                scope.close();
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/94a72a29/phoenix-hadoop2-compat/src/main/java/org/apache/phoenix/trace/TraceMetricSource.java
----------------------------------------------------------------------
diff --git a/phoenix-hadoop2-compat/src/main/java/org/apache/phoenix/trace/TraceMetricSource.java
b/phoenix-hadoop2-compat/src/main/java/org/apache/phoenix/trace/TraceMetricSource.java
index ec40722..1114a95 100644
--- a/phoenix-hadoop2-compat/src/main/java/org/apache/phoenix/trace/TraceMetricSource.java
+++ b/phoenix-hadoop2-compat/src/main/java/org/apache/phoenix/trace/TraceMetricSource.java
@@ -167,7 +167,7 @@ public class TraceMetricSource implements PhoenixSpanReceiver, MetricsSource
{
     // noop
   }
 
-  private class Metric {
+  private static class Metric {
 
     List<Pair<MetricsInfo, Long>> counters = new ArrayList<Pair<MetricsInfo,
Long>>();
     List<MetricsTag> tags = new ArrayList<MetricsTag>();


Mime
View raw message