cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r771399 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: concurrent/ db/ net/ service/ utils/
Date Mon, 04 May 2009 19:01:56 GMT
Author: jbellis
Date: Mon May  4 19:01:56 2009
New Revision: 771399

URL: http://svn.apache.org/viewvc?rev=771399&view=rev
Log:
add constructor to DTPE for most commonly used values (single thread, no timeout, LinkedBlockingQueue)
patch by jbellis; reviewed by nk11 for CASSANDRA-120

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MemtableManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LeaderElector.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
Mon May  4 19:01:56 2009
@@ -34,8 +34,13 @@
 
 public class DebuggableThreadPoolExecutor extends ThreadPoolExecutor
 {
-    private static Logger logger_ = Logger.getLogger(DebuggableThreadPoolExecutor.class);
   
-    
+    private static Logger logger_ = Logger.getLogger(DebuggableThreadPoolExecutor.class);
+
+    public DebuggableThreadPoolExecutor(String threadPoolName) 
+    {
+        this(1, 1, Integer.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new ThreadFactoryImpl(threadPoolName));
+    }
+
     public DebuggableThreadPoolExecutor(int corePoolSize,
             int maximumPoolSize,
             long keepAliveTime,

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/SingleThreadedStage.java
Mon May  4 19:01:56 2009
@@ -40,15 +40,8 @@
 
 	public SingleThreadedStage(String name)
     {
-        //executorService_ = new DebuggableScheduledThreadPoolExecutor(1,new ThreadFactoryImpl(name));
-        executorService_ = new DebuggableThreadPoolExecutor( 1,
-                1,
-                Integer.MAX_VALUE,
-                TimeUnit.SECONDS,
-                new LinkedBlockingQueue<Runnable>(),
-                new ThreadFactoryImpl(name)
-                );        
-        name_ = name;        
+        executorService_ = new DebuggableThreadPoolExecutor(name);
+        name_ = name;
 	}
 	
     /* Implementing the IStage interface methods */

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
Mon May  4 19:01:56 2009
@@ -81,13 +81,7 @@
         }
     }
     
-    private ExecutorService flusher_ = new DebuggableThreadPoolExecutor( 1,
-            1,
-            Integer.MAX_VALUE,
-            TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new ThreadFactoryImpl("BINARY-MEMTABLE-FLUSHER-POOL")
-            );  
+    private ExecutorService flusher_ = new DebuggableThreadPoolExecutor("BINARY-MEMTABLE-FLUSHER-POOL");
     
     /* Submit memtables to be flushed to disk */
     void submit(String cfName, BinaryMemtable memtbl)

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Mon May  4 19:01:56
2009
@@ -420,7 +420,7 @@
 
         public MemtableThreadPoolExecutor()
         {
-            super(1, 1, Integer.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new ThreadFactoryImpl("FAST-MEMTABLE-POOL"));
+            super("FAST-MEMTABLE-POOL");
         }
 
         protected void terminated()

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MemtableManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MemtableManager.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MemtableManager.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MemtableManager.java Mon May
 4 19:01:56 2009
@@ -93,13 +93,7 @@
     }
     
     private Map<String, List<Memtable>> history_ = new HashMap<String, List<Memtable>>();
-    ExecutorService flusher_ = new DebuggableThreadPoolExecutor( 1,
-            1,
-            Integer.MAX_VALUE,
-            TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new ThreadFactoryImpl("MEMTABLE-FLUSHER-POOL")
-            );  
+    ExecutorService flusher_ = new DebuggableThreadPoolExecutor("MEMTABLE-FLUSHER-POOL");
     
     /* Submit memtables to be flushed to disk */
     void submit(String cfName, Memtable memtbl, CommitLog.CommitLogContext cLogCtx)

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java Mon
May  4 19:01:56 2009
@@ -219,13 +219,7 @@
                 new ThreadFactoryImpl("MESSAGE-DESERIALIZER-POOL")
                 ); 
         
-        streamExecutor_ = new DebuggableThreadPoolExecutor( 1,
-                1,
-                Integer.MAX_VALUE,
-                TimeUnit.SECONDS,
-                new LinkedBlockingQueue<Runnable>(),
-                new ThreadFactoryImpl("MESSAGE-STREAMING-POOL")
-                ); 
+        streamExecutor_ = new DebuggableThreadPoolExecutor("MESSAGE-STREAMING-POOL");
                 
         protocol_ = hash(HashingSchemes.MD5, "FB-MESSAGING".getBytes());        
         /* register the response verb handler */

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LeaderElector.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LeaderElector.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LeaderElector.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/LeaderElector.java Mon
May  4 19:01:56 2009
@@ -80,13 +80,7 @@
     /* The elected leader. */
     private AtomicReference<EndPoint> leader_;
     private Condition condition_;
-    private ExecutorService leaderElectionService_ = new DebuggableThreadPoolExecutor(1,
-            1,
-            Integer.MAX_VALUE,
-            TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new ThreadFactoryImpl("LEADER-ELECTOR")
-            );
+    private ExecutorService leaderElectionService_ = new DebuggableThreadPoolExecutor("LEADER-ELECTOR");
     
     private class LeaderDeathMonitor implements Runnable
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageLoadBalancer.java
Mon May  4 19:01:56 2009
@@ -187,13 +187,7 @@
             new ThreadFactoryImpl("LB-OPERATIONS")
             );
     /* This thread pool is used by target node to leave the ring. */
-    private ExecutorService lbOperations_ = new DebuggableThreadPoolExecutor(1,
-            1,
-            Integer.MAX_VALUE,
-            TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new ThreadFactoryImpl("LB-TARGET")
-            );
+    private ExecutorService lbOperations_ = new DebuggableThreadPoolExecutor("LB-TARGET");
 
     StorageLoadBalancer(StorageService storageService)
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Mon
May  4 19:01:56 2009
@@ -250,10 +250,7 @@
     private AtomicBoolean isShutdown_ = new AtomicBoolean(false);
 
     /* This thread pool is used to do the bootstrap for a new node */
-    private ExecutorService bootStrapper_ = new DebuggableThreadPoolExecutor(1, 1,
-            Integer.MAX_VALUE, TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(), new ThreadFactoryImpl(
-                    "BOOT-STRAPPER"));
+    private ExecutorService bootStrapper_ = new DebuggableThreadPoolExecutor("BOOT-STRAPPER");
     
     /* This thread pool does consistency checks when the client doesn't care about consistency
*/
     private ExecutorService consistencyManager_;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java?rev=771399&r1=771398&r2=771399&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FileUtils.java Mon May 
4 19:01:56 2009
@@ -45,13 +45,7 @@
     private static final double gb_ = 1024*1024*1024d;
     private static final double tb_ = 1024*1024*1024*1024d;
 
-    private static ExecutorService deleter_ = new DebuggableThreadPoolExecutor( 1,
-            1,
-            Integer.MAX_VALUE,
-            TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(),
-            new ThreadFactoryImpl("FILEUTILS-DELETE-POOL")
-            );
+    private static ExecutorService deleter_ = new DebuggableThreadPoolExecutor("FILEUTILS-DELETE-POOL");
 
     public static void shutdown()
     {



Mime
View raw message