Author: ron.sigal(a)jboss.com
Date: 2008-06-22 01:55:53 -0400 (Sun, 22 Jun 2008)
New Revision: 4309
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerThread.java
Log:
JBREM-1002: Introduced CONTINUE_AFTER_TIMEOUT parameter.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerThread.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2008-06-22
05:30:30 UTC (rev 4308)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerThread.java 2008-06-22
05:55:53 UTC (rev 4309)
@@ -36,6 +36,7 @@
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;
@@ -72,7 +73,11 @@
public class ServerThread extends Thread
{
// Constants
------------------------------------------------------------------------------------
-
+
+ /** 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
---------------------------------------------------------------------------------------
@@ -118,6 +123,8 @@
// Will indicate when the last request has been processed (used in determining idle
// connection/thread timeout)
private long lastRequestHandledTimestamp = System.currentTimeMillis();
+
+ private boolean reuseAfterTimeout;
// Constructors
---------------------------------------------------------------------------------
@@ -368,6 +375,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);
@@ -403,6 +436,9 @@
log.trace(ste);
}
}
+
+ if (!reuseAfterTimeout)
+ running = false;
}
catch (InterruptedIOException e)
{