[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ron Sigal
ron_sigal at yahoo.com
Wed Feb 21 05:55:23 EST 2007
User: rsigal
Date: 07/02/21 05:55:23
Modified: src/main/org/jboss/remoting Tag: remoting_2_x Client.java
Log:
JBREM-598, JBREM-657: Added disconnectTimeout variable.
Revision Changes Path
No revision
No revision
1.53.2.23 +30 -3 JBossRemoting/src/main/org/jboss/remoting/Client.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Client.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/Client.java,v
retrieving revision 1.53.2.22
retrieving revision 1.53.2.23
diff -u -b -r1.53.2.22 -r1.53.2.23
--- Client.java 21 Feb 2007 04:24:31 -0000 1.53.2.22
+++ Client.java 21 Feb 2007 10:55:23 -0000 1.53.2.23
@@ -64,7 +64,7 @@
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
*
- * @version $Revision: 1.53.2.22 $
+ * @version $Revision: 1.53.2.23 $
*/
public class Client implements Externalizable
{
@@ -141,6 +141,12 @@
*/
public static final String MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE = "maxOnewayThreadPoolQueueSize";
+ /**
+ * Default timeout period for network i/o in disconnect() and removeListener().
+ * -1 indicates that no special per invocation timeout will be set.
+ */
+ public static final int DEFAULT_DISCONNECT_TIMEOUT = -1;
+
private static final Logger log = Logger.getLogger(Client.class);
private static final long serialVersionUID = 5679279425009837934L;
@@ -172,6 +178,8 @@
private SocketFactory socketFactory;
+ private int disconnectTimeout = DEFAULT_DISCONNECT_TIMEOUT;
+
private boolean connected = false;
// Constructors ---------------------------------------------------------------------------------
@@ -446,7 +454,7 @@
if (invoker != null)
{
// this is a noop if no lease is active
- invoker.terminateLease(sessionId);
+ invoker.terminateLease(sessionId, disconnectTimeout);
if (connectionValidator != null)
{
@@ -571,6 +579,22 @@
}
/**
+ * Gets the timeout used for network i/o in disconnect() and removeListener().
+ */
+ public int getDisconnectTimeout()
+ {
+ return disconnectTimeout;
+ }
+
+ /**
+ * Sets the timeout used for network i/o in disconnect() and removeListener().
+ */
+ public void setDisconnectTimeout(int disconnectTimeout)
+ {
+ this.disconnectTimeout = disconnectTimeout;
+ }
+
+ /**
* Sets the maximum queue size to use within client pool for one way invocations on the client
* side (meaning oneway invocation is handled by thread in this pool and user's call returns
* immediately). Default value is MAX_NUM_ONEWAY_THREADS.
@@ -981,6 +1005,9 @@
Map metadata = new HashMap();
metadata.put(LISTENER_ID_KEY, listenerId);
+ if (disconnectTimeout >= 0)
+ metadata.put(ServerInvoker.TIMEOUT, Integer.toString(disconnectTimeout));
+
try
{
// now call target server to remove listener
More information about the jboss-cvs-commits
mailing list