Author: ron.sigal(a)jboss.com
Date: 2011-03-19 17:04:11 -0400 (Sat, 19 Mar 2011)
New Revision: 6285
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-1277: Add accept thread priority configuration option.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-03-19
20:51:35 UTC (rev 6284)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2011-03-19
21:04:11 UTC (rev 6285)
@@ -101,6 +101,7 @@
protected LRUPool clientpool;
protected LinkedList threadpool;
protected boolean immediateShutdown;
+ protected int acceptThreadPriorityIncrement = 0;
protected ServerSocketRefresh refreshThread;
protected boolean newServerSocketFactory = false;
@@ -261,7 +262,11 @@
ServerSocket ss = (ServerSocket) it.next();
for(int j = 0; j < numAcceptThreads; j++)
{
- acceptThreads[i++] = new AcceptThread(ss, refreshThread);
+ acceptThreads[i] = new AcceptThread(ss, refreshThread);
+ acceptThreads[i].setPriority(Thread.NORM_PRIORITY +
acceptThreadPriorityIncrement);
+ if(trace) { log.trace(this + " created and registered " +
acceptThreads[i]
+ + " with priority " +
acceptThreads[i].getPriority()); }
+ i++;
}
}
}
@@ -735,7 +740,25 @@
{
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;
+ }
+ }
+
protected void configureSocket(Socket s) throws SocketException
{
s.setReuseAddress(getReuseAddress());