[jboss-remoting-commits] JBoss Remoting SVN: r6281 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Mar 19 16:37:02 EDT 2011


Author: ron.sigal at jboss.com
Date: 2011-03-19 16:37:01 -0400 (Sat, 19 Mar 2011)
New Revision: 6281

Modified:
   remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-1277: Add accept thread priority configuration option.

Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java	2011-03-16 02:59:29 UTC (rev 6280)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java	2011-03-19 20:37:01 UTC (rev 6281)
@@ -86,6 +86,7 @@
    protected int maxPoolSize = MAX_POOL_SIZE_DEFAULT;
    protected LRUPool clientpool;
    protected LinkedList threadpool;
+   protected int acceptThreadPriorityIncrement = 0;
 
    protected boolean newServerSocketFactory = false;
    protected Object serverSocketFactoryLock = new Object();
@@ -214,8 +215,10 @@
 
             String name = getThreadName(i);
             acceptThreads[i] = new Thread(this, name);
+            acceptThreads[i].setPriority(Thread.NORM_PRIORITY + acceptThreadPriorityIncrement);
 
-            if(trace) { log.trace(this + " created and registered " + acceptThreads[i]); }
+            if(trace) { log.trace(this + " created and registered " + acceptThreads[i] 
+                                       + " with priority " + acceptThreads[i].getPriority()); }
          }
       }
 
@@ -511,6 +514,24 @@
       this.writeTimeout = writeTimeout;
    }
 
+   public int getAcceptThreadPriorityIncrement()
+   {
+      return acceptThreadPriorityIncrement;
+   }
+
+   public void setAcceptThreadPriorityIncrement(int acceptThreadPriorityIncrement)
+   {
+      int resultingPriority = Thread.NORM_PRIORITY + acceptThreadPriorityIncrement;
+      if (resultingPriority < Thread.MIN_PRIORITY || resultingPriority > Thread.MAX_PRIORITY)
+      {
+         log.warn(this + " resulting priority out of range: " + resultingPriority);
+      }
+      else
+      {
+         this.acceptThreadPriorityIncrement = acceptThreadPriorityIncrement;
+      }
+   }
+
    public void run()
    {
       if(trace) { log.trace(this + " started execution of method run()"); }



More information about the jboss-remoting-commits mailing list