accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject accumulo git commit: ACCUMULO-2240 Refactor Trace Server's batch writer parameters into constants
Date Mon, 15 Jun 2015 14:09:37 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.7 341034a56 -> 1f8954fb0


ACCUMULO-2240 Refactor Trace Server's batch writer parameters into constants


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1f8954fb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1f8954fb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1f8954fb

Branch: refs/heads/1.7
Commit: 1f8954fb06048a0fdd6d69ead0e53e2911106f99
Parents: 341034a
Author: Steve Blackmore <steveblackmore10@gmail.com>
Authored: Mon Jun 1 10:04:21 2015 +0100
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Jun 15 10:09:15 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/tracer/TraceServer.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1f8954fb/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index e3265b4..ee75cda 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -85,6 +85,9 @@ public class TraceServer implements Watcher {
   final private AtomicReference<BatchWriter> writer;
   final private Connector connector;
   final String table;
+  final private static int BATCH_WRITER_MAX_LATENCY = 5;
+  final private static long SCHEDULE_PERIOD = 1000;
+  final private static long SCHEDULE_DELAY = 1000;
 
   private static void put(Mutation m, String cf, String cq, byte[] bytes, int len) {
     m.put(new Text(cf), new Text(cq), new Value(bytes, 0, len));
@@ -233,7 +236,7 @@ public class TraceServer implements Watcher {
     options.processor(new Processor<Iface>(new Receiver()));
     server = new TThreadPoolServer(options);
     registerInZooKeeper(sock.getInetAddress().getHostAddress() + ":" + sock.getLocalPort(),
conf.get(Property.TRACE_ZK_PATH));
-    writer = new AtomicReference<BatchWriter>(this.connector.createBatchWriter(table,
new BatchWriterConfig().setMaxLatency(5, TimeUnit.SECONDS)));
+    writer = new AtomicReference<BatchWriter>(this.connector.createBatchWriter(table,
new BatchWriterConfig().setMaxLatency(BATCH_WRITER_MAX_LATENCY, TimeUnit.SECONDS)));
   }
 
   public void run() throws Exception {
@@ -242,7 +245,7 @@ public class TraceServer implements Watcher {
       public void run() {
         flush();
       }
-    }, 1000, 1000);
+    }, SCHEDULE_DELAY, SCHEDULE_PERIOD);
     server.serve();
   }
 
@@ -272,7 +275,7 @@ public class TraceServer implements Watcher {
   private void resetWriter() {
     BatchWriter writer = null;
     try {
-      writer = connector.createBatchWriter(table, new BatchWriterConfig().setMaxLatency(5,
TimeUnit.SECONDS));
+      writer = connector.createBatchWriter(table, new BatchWriterConfig().setMaxLatency(BATCH_WRITER_MAX_LATENCY,
TimeUnit.SECONDS));
     } catch (Exception ex) {
       log.warn("Unable to create a batch writer, will retry. Set log level to DEBUG to see
stacktrace. cause: " + ex);
       log.debug("batch writer creation failed with exception.", ex);


Mime
View raw message