accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1438312 [5/5] - in /accumulo/branches/ACCUMULO-259: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/mapred/...
Date Fri, 25 Jan 2013 03:56:16 GMT
Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java?rev=1438312&r1=1438311&r2=1438312&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
(original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
Fri Jan 25 03:56:14 2013
@@ -23,7 +23,6 @@ import java.net.ServerSocket;
 import java.net.UnknownHostException;
 import java.nio.channels.ServerSocketChannel;
 import java.util.Random;
-import java.util.TimerTask;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ThreadPoolExecutor;
 
@@ -193,7 +192,7 @@ public class TServerUtils {
      */
     final ThreadPoolExecutor pool = new SimpleThreadPool(numThreads, "ClientPool");
     // periodically adjust the number of threads we need by checking how busy our threads
are
-    SimpleTimer.getInstance().schedule(new TimerTask() {
+    SimpleTimer.getInstance().schedule(new Runnable() {
       @Override
       public void run() {
         if (pool.getCorePoolSize() <= pool.getActiveCount()) {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/time/SimpleTimer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/time/SimpleTimer.java?rev=1438312&r1=1438311&r2=1438312&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/time/SimpleTimer.java
(original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/time/SimpleTimer.java
Fri Jan 25 03:56:14 2013
@@ -19,6 +19,8 @@ package org.apache.accumulo.server.util.
 import java.util.Timer;
 import java.util.TimerTask;
 
+import org.apache.log4j.Logger;
+
 /**
  * Generic singleton timer: don't use it if you are going to do anything that will take very
long. Please use it to reduce the number of threads dedicated to
  * simple events.
@@ -26,6 +28,25 @@ import java.util.TimerTask;
  */
 public class SimpleTimer {
   
+  static class LoggingTimerTask extends TimerTask {
+    
+    private Runnable task;
+    
+    LoggingTimerTask(Runnable task) {
+      this.task = task;
+    }
+    
+    @Override
+    public void run() {
+      try {
+        task.run();
+      } catch (Throwable t) {
+        Logger.getLogger(LoggingTimerTask.class).warn("Timer task failed " + task.getClass().getName()
+ " " + t.getMessage(), t);
+      }
+    }
+    
+  }
+
   private static SimpleTimer instance;
   private Timer timer;
   
@@ -39,12 +60,12 @@ public class SimpleTimer {
     timer = new Timer("SimpleTimer", true);
   }
   
-  public void schedule(TimerTask task, long delay) {
-    timer.schedule(task, delay);
+  public void schedule(Runnable task, long delay) {
+    timer.schedule(new LoggingTimerTask(task), delay);
   }
   
-  public void schedule(TimerTask task, long delay, long period) {
-    timer.schedule(task, delay, period);
+  public void schedule(Runnable task, long delay, long period) {
+    timer.schedule(new LoggingTimerTask(task), delay, period);
   }
   
 }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java?rev=1438312&r1=1438311&r2=1438312&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
(original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/DistributedWorkQueue.java
Fri Jan 25 03:56:14 2013
@@ -20,7 +20,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 import java.util.Set;
-import java.util.TimerTask;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -189,7 +188,7 @@ public class DistributedWorkQueue {
     
     Random r = new Random();
     // Add a little jitter to avoid all the tservers slamming zookeeper at once
-    SimpleTimer.getInstance().schedule(new TimerTask() {
+    SimpleTimer.getInstance().schedule(new Runnable() {
       @Override
       public void run() {
         try {

Propchange: accumulo/branches/ACCUMULO-259/src/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/src:r1437608-1438309

Modified: accumulo/branches/ACCUMULO-259/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java?rev=1438312&r1=1438311&r2=1438312&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
(original)
+++ accumulo/branches/ACCUMULO-259/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
Fri Jan 25 03:56:14 2013
@@ -119,7 +119,7 @@ public class ContextManager {
     synchronized (this) {
       // only manipulate internal data structs in this sync block... avoid creating or closing
classloader, reading config, etc... basically avoid operations
       // that may block
-      context = contexts.get(context);
+      context = contexts.get(contextName);
       
       if (context == null) {
         context = new Context(cconfig);

Modified: accumulo/branches/ACCUMULO-259/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java?rev=1438312&r1=1438311&r2=1438312&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
(original)
+++ accumulo/branches/ACCUMULO-259/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
Fri Jan 25 03:56:14 2013
@@ -32,7 +32,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Random;
-import java.util.TimerTask;
 
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.UtilWaitThread;
@@ -63,7 +62,7 @@ public class MiniAccumuloCluster {
       this.in = new BufferedReader(new InputStreamReader(stream));
       out = new BufferedWriter(new FileWriter(logFile));
       
-      SimpleTimer.getInstance().schedule(new TimerTask() {
+      SimpleTimer.getInstance().schedule(new Runnable() {
         @Override
         public void run() {
           try {



Mime
View raw message