cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r958123 - in /cassandra/branches/cassandra-0.6: ./ src/java/org/apache/cassandra/concurrent/ src/java/org/apache/cassandra/db/
Date Fri, 25 Jun 2010 21:40:28 GMT
Author: jbellis
Date: Fri Jun 25 21:40:28 2010
New Revision: 958123

URL: http://svn.apache.org/viewvc?rev=958123&view=rev
Log:
add ability to lower compaction priority.  patch by jbellis; reviewed by Brandon Williams
for CASSANDRA-1181

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=958123&r1=958122&r2=958123&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Fri Jun 25 21:40:28 2010
@@ -34,6 +34,8 @@
    the same time.  repairs are now fully manual (CASSANDRA-1190)
  * avoid queuing multiple hint deliveries for the same endpoint
    (CASSANDRA-1229)
+ * add ability to lower compaction priority (default is no change from 0.6.2)
+   (CASSANDRA-1181)
 
 
 0.6.2

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=958123&r1=958122&r2=958123&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
Fri Jun 25 21:40:28 2010
@@ -29,9 +29,9 @@ public class DebuggableThreadPoolExecuto
 {
     protected static Logger logger = Logger.getLogger(DebuggableThreadPoolExecutor.class);
 
-    public DebuggableThreadPoolExecutor(String threadPoolName)
+    public DebuggableThreadPoolExecutor(String threadPoolName, int priority)
     {
-        this(1, 1, Integer.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory(threadPoolName));
+        this(1, 1, Integer.MAX_VALUE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory(threadPoolName, priority));
     }
 
     public DebuggableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime,
TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java?rev=958123&r1=958122&r2=958123&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java
Fri Jun 25 21:40:28 2010
@@ -30,16 +30,26 @@ import java.util.concurrent.atomic.*;
 public class NamedThreadFactory implements ThreadFactory
 {
     protected final String id;
+    private final int priority;
     protected final AtomicInteger n = new AtomicInteger(1);
 
     public NamedThreadFactory(String id)
     {
+        this(id, Thread.NORM_PRIORITY);
+    }
+
+    public NamedThreadFactory(String id, int priority)
+    {
+
         this.id = id;
+        this.priority = priority;
     }
 
     public Thread newThread(Runnable runnable)
     {        
         String name = id + ":" + n.getAndIncrement();
-        return new Thread(runnable, name);
+        Thread thread = new Thread(runnable, name);
+        thread.setPriority(priority);
+        return thread;
     }
 }

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java?rev=958123&r1=958122&r2=958123&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/CompactionManager.java
Fri Jun 25 21:40:28 2010
@@ -566,7 +566,9 @@ public class CompactionManager implement
 
         public CompactionExecutor()
         {
-            super("COMPACTION-POOL");
+            super("COMPACTION-POOL", System.getProperty("cassandra.compaction.priority")
== null
+                                     ? Thread.NORM_PRIORITY
+                                     : Integer.parseInt(System.getProperty("cassandra.compaction.priority")));
         }
 
         @Override



Mime
View raw message