You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/11/13 19:56:34 UTC

[1/2] git commit: ACCUMULO-1307 applying [~vines]'s patch (minus formatting changes)

Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 050e7e25d -> a0a4a2816
  refs/heads/master 19848636f -> ac55104ba


ACCUMULO-1307 applying [~vines]'s patch (minus formatting changes)


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

Branch: refs/heads/master
Commit: ac55104ba53ce846bba32b2c5a85cfd604c28091
Parents: 1984863
Author: Eric Newton <er...@gmail.com>
Authored: Wed Nov 13 13:56:17 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Wed Nov 13 13:56:35 2013 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/fate/Fate.java    | 16 +++++++++++++---
 .../java/org/apache/accumulo/master/Master.java     |  2 ++
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ac55104b/fate/src/main/java/org/apache/accumulo/fate/Fate.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/Fate.java b/fate/src/main/java/org/apache/accumulo/fate/Fate.java
index bd36edb..5ddec9c 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/Fate.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/Fate.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.fate;
 
 import java.util.EnumSet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.accumulo.fate.TStore.TStatus;
 import org.apache.accumulo.fate.util.Daemon;
@@ -43,11 +44,13 @@ public class Fate<T> {
   
   private static final EnumSet<TStatus> FINISHED_STATES = EnumSet.of(TStatus.FAILED, TStatus.SUCCESSFUL, TStatus.UNKNOWN);
   
+  private AtomicBoolean keepRunning = new AtomicBoolean(true);
+  
   private class TransactionRunner implements Runnable {
     
     @Override
     public void run() {
-      while (true) {
+      while (keepRunning.get()) {
         long deferTime = 0;
         long tid = store.reserve();
         try {
@@ -135,11 +138,11 @@ public class Fate<T> {
     
   }
   
-  public Fate(T environment, TStore<T> store, int numTreads) {
+  public Fate(T environment, TStore<T> store, int numThreads) {
     this.store = store;
     this.environment = environment;
     
-    for (int i = 0; i < numTreads; i++) {
+    for (int i = 0; i < numThreads; i++) {
       // TODO: use an ExecutorService, maybe a utility to do these steps throughout the server packages - ACCUMULO-1311
       Thread thread = new Daemon(new LoggingRunnable(log, new TransactionRunner()), "Repo runner " + i);
       thread.start();
@@ -230,4 +233,11 @@ public class Fate<T> {
     }
   }
   
+  /**
+   * Flags that FATE threadpool to clear out and end. Does not actively stop running FATE processes.
+   */
+  public void shutdown() {
+    keepRunning.set(false);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ac55104b/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 887f527..212daa3 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1556,6 +1556,8 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     while (clientService.isServing()) {
       UtilWaitThread.sleep(500);
     }
+    log.info("Shutting down fate.");
+    fate.shutdown();
 
     final long deadline = System.currentTimeMillis() + MAX_CLEANUP_WAIT_TIME;
     statusThread.join(remaining(deadline));


[2/2] git commit: ACCUMULO-1307 applying [~vines]'s patch (minus formatting changes)

Posted by ec...@apache.org.
ACCUMULO-1307 applying [~vines]'s patch (minus formatting changes)


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: a0a4a2816ad01755886be723b671dc298e1d7511
Parents: 050e7e2
Author: Eric Newton <er...@gmail.com>
Authored: Wed Nov 13 13:56:17 2013 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Wed Nov 13 13:56:52 2013 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/fate/Fate.java    | 16 +++++++++++++---
 .../java/org/apache/accumulo/master/Master.java     |  2 ++
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a0a4a281/fate/src/main/java/org/apache/accumulo/fate/Fate.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/Fate.java b/fate/src/main/java/org/apache/accumulo/fate/Fate.java
index bd36edb..5ddec9c 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/Fate.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/Fate.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.fate;
 
 import java.util.EnumSet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.accumulo.fate.TStore.TStatus;
 import org.apache.accumulo.fate.util.Daemon;
@@ -43,11 +44,13 @@ public class Fate<T> {
   
   private static final EnumSet<TStatus> FINISHED_STATES = EnumSet.of(TStatus.FAILED, TStatus.SUCCESSFUL, TStatus.UNKNOWN);
   
+  private AtomicBoolean keepRunning = new AtomicBoolean(true);
+  
   private class TransactionRunner implements Runnable {
     
     @Override
     public void run() {
-      while (true) {
+      while (keepRunning.get()) {
         long deferTime = 0;
         long tid = store.reserve();
         try {
@@ -135,11 +138,11 @@ public class Fate<T> {
     
   }
   
-  public Fate(T environment, TStore<T> store, int numTreads) {
+  public Fate(T environment, TStore<T> store, int numThreads) {
     this.store = store;
     this.environment = environment;
     
-    for (int i = 0; i < numTreads; i++) {
+    for (int i = 0; i < numThreads; i++) {
       // TODO: use an ExecutorService, maybe a utility to do these steps throughout the server packages - ACCUMULO-1311
       Thread thread = new Daemon(new LoggingRunnable(log, new TransactionRunner()), "Repo runner " + i);
       thread.start();
@@ -230,4 +233,11 @@ public class Fate<T> {
     }
   }
   
+  /**
+   * Flags that FATE threadpool to clear out and end. Does not actively stop running FATE processes.
+   */
+  public void shutdown() {
+    keepRunning.set(false);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a0a4a281/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 887f527..212daa3 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1556,6 +1556,8 @@ public class Master implements LiveTServerSet.Listener, TableObserver, CurrentSt
     while (clientService.isServing()) {
       UtilWaitThread.sleep(500);
     }
+    log.info("Shutting down fate.");
+    fate.shutdown();
 
     final long deadline = System.currentTimeMillis() + MAX_CLEANUP_WAIT_TIME;
     statusThread.join(remaining(deadline));