[jboss-remoting-commits] JBoss Remoting SVN: r3999 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Wed Apr 16 20:48:55 EDT 2008
Author: ron.sigal at jboss.com
Date: 2008-04-16 20:48:55 -0400 (Wed, 16 Apr 2008)
New Revision: 3999
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java
Log:
JBREM-953: (1) Added CONTINUE_AFTER_TIMEOUT flag and related processing; (2) uses SecurityUtility to get classloader.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2008-04-16 18:08:27 UTC (rev 3998)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2008-04-17 00:48:55 UTC (rev 3999)
@@ -32,12 +32,14 @@
import org.jboss.remoting.Version;
import org.jboss.remoting.Client;
import org.jboss.remoting.serialization.ClassLoaderUtility;
+import org.jboss.remoting.util.SecurityUtility;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.remoting.marshal.VersionedMarshaller;
import org.jboss.remoting.marshal.VersionedUnMarshaller;
+import org.jboss.serial.io.JBossObjectInputStream;
import java.io.EOFException;
import java.io.IOException;
@@ -82,6 +84,10 @@
public static final String EVICTABILITY_TIMEOUT = "evictabilityTimeout";
public static final int EVICTABILITY_TIMEOUT_DEFAULT = 10000;
+ /** Key used to determine if thread should return to threadpool after
+ * SocketTimeoutException */
+ public static final String CONTINUE_AFTER_TIMEOUT = "continueAfterTimeout";
+
final static private Logger log = Logger.getLogger(ServerThread.class);
// Static ---------------------------------------------------------------------------------------
@@ -137,6 +143,8 @@
// Period during which ServerThread is not evictable on first
// invocation even when in evictable state. */
private int evictabilityTimeout = EVICTABILITY_TIMEOUT_DEFAULT;
+
+ private boolean reuseAfterTimeout;
// Constructors ---------------------------------------------------------------------------------
@@ -456,6 +464,32 @@
socketWrapper =
createServerSocketWrapper(socket, timeout, invoker.getLocator().getParameters());
+ boolean valueSet = false;
+ Map configMap = invoker.getConfiguration();
+ Object o = configMap.get(CONTINUE_AFTER_TIMEOUT);
+ if (o != null)
+ {
+ try
+ {
+ reuseAfterTimeout = Boolean.valueOf((String)o).booleanValue();
+ valueSet = true;
+ log.debug(this + " setting reuseAfterTimeout to " + reuseAfterTimeout);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " + CONTINUE_AFTER_TIMEOUT +
+ " value of " + o + " to a boolean value");
+ }
+ }
+
+ if (!valueSet)
+ {
+ if (socketWrapper.getInputStream() instanceof JBossObjectInputStream)
+ {
+ reuseAfterTimeout = true;
+ }
+ }
+
// Always do first one without an ACK because its not needed
if(trace) { log.trace("processing first invocation without acknowledging"); }
processInvocation(socketWrapper);
@@ -509,6 +543,9 @@
log.trace(this + " timed out", ste);
}
}
+
+ if (!reuseAfterTimeout)
+ running = false;
}
catch (InterruptedIOException e)
{
@@ -540,7 +577,7 @@
}
catch (SocketException sex)
{
- if (!shutdown && true)
+ if (!shutdown && trace)
{
if (trace) log.trace(this + " SocketException received. This is likely due to client disconnecting and resetting connection.", sex);
}
@@ -903,14 +940,7 @@
{
InvokerLocator locator = invoker.getLocator();
- ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged( new PrivilegedAction()
- {
- public Object run()
- {
- return ServerThread.class.getClassLoader();
- }
- });
-
+ ClassLoader classLoader = SecurityUtility.getClassLoader(ServerThread.class);
String dataType = invoker.getDataType();
String serializationType = invoker.getSerializationType();
More information about the jboss-remoting-commits
mailing list