[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...
Ovidiu Feodorov
ovidiu.feodorov at jboss.com
Sun Jan 21 03:38:33 EST 2007
User: ovidiu
Date: 07/01/21 03:38:33
Modified: src/main/org/jboss/remoting Tag: remoting_2_x
Client.java ConnectionListener.java
InvokerRegistry.java LeasePinger.java
MicroRemoteClientInvoker.java ServerInvoker.java
Log:
http://jira.jboss.org/jira/browse/JBREM-681
Revision Changes Path
No revision
No revision
1.53.2.18 +60 -57 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.17
retrieving revision 1.53.2.18
diff -u -b -r1.53.2.17 -r1.53.2.18
--- Client.java 21 Jan 2007 01:24:51 -0000 1.53.2.17
+++ Client.java 21 Jan 2007 08:38:32 -0000 1.53.2.18
@@ -64,15 +64,14 @@
* @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.17 $
+ * @version $Revision: 1.53.2.18 $
*/
public class Client implements Externalizable
{
// Constants ------------------------------------------------------------------------------------
/**
- * Key to be used to determine if invocation is to be
- * oneway (async).
+ * Key to be used to determine if invocation is to be oneway (async).
*/
public static final String ONEWAY_FLAG = "oneway";
@@ -82,71 +81,63 @@
public static final String LISTENER_ID_KEY = "listenerId";
/**
- * Specifies the default number of work threads in the pool for
- * executing one way invocations on the client.
- * Value is 10.
+ * Specifies the default number of work threads in the pool for executing one way invocations on
+ * the client. Value is 10.
*/
public static final int MAX_NUM_ONEWAY_THREADS_DEFAULT = 10;
/**
- * The key to use for the metadata Map passed when making a invoke() call
- * and wish for the invocation payload to be sent as is and not wrapped
- * within a remoting invocation request object. This should be used
- * when want to make direct calls on systems outside of remoting
+ * The key to use for the metadata Map passed when making a invoke() call and wish for the
+ * invocation payload to be sent as is and not wrapped within a remoting invocation request
+ * object. This should be used when want to make direct calls on systems outside of remoting
* (e.g. making a http POST request to a web service).
*/
public static final String RAW = "rawPayload";
/**
- * Key for the configuration map passed to the Client constructor
- * to indicate that client should make initial request to establish
- * lease with server. The value for this should be
- * either a String that java.lang.Boolean can evaluate or a java.lang.Boolean.
- * Client leasing is turned off by default, so would need to use this property
- * to turn client leasing on.
+ * Key for the configuration map passed to the Client constructor to indicate that client should
+ * make initial request to establish lease with server. The value for this should be either a
+ * String that java.lang.Boolean can evaluate or a java.lang.Boolean. Client leasing is turned
+ * off by default, so would need to use this property to turn client leasing on.
*/
public static final String ENABLE_LEASE = "enableLease";
/**
- * Key for the configuration map passed to the Client constructor providing a
- * ssl javax.net.ssl.HandshakeCompletedListener implementation, which will
- * be called on when ssl handshake completed with server.
+ * Key for the configuration map passed to the Client constructor providing a ssl
+ * javax.net.ssl.HandshakeCompletedListener implementation, which will be called on when ssl
+ * handshake completed with server.
*/
public static final String HANDSHAKE_COMPLETED_LISTENER = "handshakeCompletedListener";
/**
* Key for the configuration when adding a callback handler and internal callback server
- * connector is created. The value should be the transport protocol to be used. By default
- * will use the same protocol as being used by this client (e.g. http, socket, rmi, multiplex,
- * etc.)
+ * connector is created. The value should be the transport protocol to be used. By default will
+ * use the same protocol as being used by this client (e.g. http, socket, rmi, multiplex, etc.)
*/
public static final String CALLBACK_SERVER_PROTOCOL = "callbackServerProtocol";
/**
* Key for the configuration when adding a callback handler and internal callback server
- * connector is created. The value should be the host name to be used. By default
- * will use the result of calling InetAddress.getLocalHost().getHostAddress().
+ * connector is created. The value should be the host name to be used. By default will use the
+ * result of calling InetAddress.getLocalHost().getHostAddress().
*/
public static final String CALLBACK_SERVER_HOST = "callbackServerHost";
/**
* Key for the configuration when adding a callback handler and internal callback server
- * connector is created. The value should be the port to be used. By default
- * will find a random unused port.
+ * connector is created. The value should be the port to be used. By default will find a random
+ * unused port.
*/
public static final String CALLBACK_SERVER_PORT = "callbackServerPort";
-
/**
- * Key for the configuration map that determines the threadpool size for
- * asynchrouous invocations.
+ * Key for the configuration map that determines the threadpool size for asynchrouous invocations.
*/
public static final String MAX_NUM_ONEWAY_THREADS = "maxNumThreadsOneway";
-
/**
- * Key for the configuration map that determines the queue size for waiting
- * asynchronous invocations.
+ * Key for the configuration map that determines the queue size for waiting asynchronous
+ * invocations.
*/
public static final String MAX_ONEWAY_THREAD_POOL_QUEUE_SIZE = "maxOnewayThreadPoolQueueSize";
@@ -173,9 +164,6 @@
private ConnectionValidator connectionValidator = null;
private Map configuration = new HashMap();
- private boolean enableLease = false;
- private long leasePeriod = -1;
-
private Map callbackConnectors = new HashMap();
private Map callbackPollers = new HashMap();
@@ -473,11 +461,8 @@
{
if (invoker != null)
{
- if(enableLease)
- {
+ // this is a noop if no lease is active
invoker.terminateLease(sessionId, local);
- enableLease = false;
- }
if (connectionValidator != null)
{
@@ -1417,6 +1402,20 @@
return connectionValidator.getPingPeriod();
}
+ /**
+ * @return the lease period (in ms) if the client has an active leasing mechanism with the server
+ * or -1 otherwise.
+ */
+ public long getLeasePeriod()
+ {
+ if (invoker == null)
+ {
+ return -1;
+ }
+
+ return invoker.getLeasePeriod(sessionId);
+ }
+
// Package protected ----------------------------------------------------------------------------
// Protected ------------------------------------------------------------------------------------
@@ -1449,14 +1448,15 @@
private void setupClientLease(ClientInvoker invoker) throws Throwable
{
+ long leasePeriod = -1;
+ boolean enableLease = false;
- // start with checking the locator url for hint as to if should do initial lease ping
+ // start with checking the locator URL for hint as to if should do initial lease ping
if (invoker != null)
{
if (invoker instanceof LocalClientInvoker)
{
- // no need to continue as won't do client lease when is local
- // JBREM-382
+ // no need to continue as won't do client lease when is local (JBREM-382)
return;
}
@@ -1464,12 +1464,13 @@
Map locatorParams = locator.getParameters();
if (locatorParams != null)
{
- String leaseValue = (String) locatorParams.get(InvokerLocator.CLIENT_LEASE);
+ String leaseValue = (String)locatorParams.get(InvokerLocator.CLIENT_LEASE);
if (leaseValue != null && leaseValue.length() > 0)
{
enableLease = Boolean.valueOf(leaseValue).booleanValue();
}
- String leasePeriodValue = (String) locatorParams.get(InvokerLocator.CLIENT_LEASE_PERIOD);
+
+ String leasePeriodValue = (String)locatorParams.get(InvokerLocator.CLIENT_LEASE_PERIOD);
if (leasePeriodValue != null && leasePeriodValue.length() > 0)
{
try
@@ -1497,11 +1498,11 @@
{
if (val instanceof Boolean)
{
- enableLease = ((Boolean) val).booleanValue();
+ enableLease = ((Boolean)val).booleanValue();
}
else if (val instanceof String)
{
- enableLease = Boolean.valueOf((String) val).booleanValue();
+ enableLease = Boolean.valueOf((String)val).booleanValue();
}
else
{
@@ -1509,7 +1510,9 @@
val + ") as a boolean type.");
}
}
- String leasePeriodValue = (String) configuration.get(InvokerLocator.CLIENT_LEASE_PERIOD);
+
+ String leasePeriodValue = (String)configuration.get(InvokerLocator.CLIENT_LEASE_PERIOD);
+
if (leasePeriodValue != null && leasePeriodValue.length() > 0)
{
try
1.4.10.1 +9 -9 JBossRemoting/src/main/org/jboss/remoting/ConnectionListener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConnectionListener.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/ConnectionListener.java,v
retrieving revision 1.4
retrieving revision 1.4.10.1
diff -u -b -r1.4 -r1.4.10.1
--- ConnectionListener.java 17 Jan 2006 18:53:40 -0000 1.4
+++ ConnectionListener.java 21 Jan 2007 08:38:32 -0000 1.4.10.1
@@ -23,12 +23,11 @@
package org.jboss.remoting;
/**
- * Listener that can be registered with the Client to receive a
- * callback if the target server for said Client is determined to
- * be unreachable at any point.
+ * Listener that can be registered with the Client to receive a callback if the target server for
+ * said Client is determined to be unreachable at any point.
* <p>
- * Can also be registered with Connector to be notified when client disconnects
- * (but only when leasing is turned on).
+ * Can also be registered with Connector to be notified when client disconnects (but only when
+ * leasing is turned on).
*
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
*/
@@ -37,10 +36,11 @@
/**
* Called when a target server or client found to be dead.
*
- * @param throwable original exception thrown when trying to connect to target server.
- * If is listener on server for client failure, the exception will be a ClientDisconnectedException
- * if the client disconnected normally, or null if the lease expired.
- * @param client the client from which this call was made.
+ * @param throwable - original exception thrown when trying to connect to target server. If is
+ * listener on server for client failure, the exception will be a
+ * ClientDisconnectedException if the client disconnected normally, or null if the lease
+ * expired.
+ * @param client - the client from which this call was made.
*/
public void handleConnectionException(Throwable throwable, Client client);
}
\ No newline at end of file
1.34.4.5 +5 -9 JBossRemoting/src/main/org/jboss/remoting/InvokerRegistry.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvokerRegistry.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/InvokerRegistry.java,v
retrieving revision 1.34.4.4
retrieving revision 1.34.4.5
diff -u -b -r1.34.4.4 -r1.34.4.5
--- InvokerRegistry.java 18 Jan 2007 02:39:10 -0000 1.34.4.4
+++ InvokerRegistry.java 21 Jan 2007 08:38:32 -0000 1.34.4.5
@@ -48,14 +48,13 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.34.4.4 $
+ * @version $Revision: 1.34.4.5 $
*/
public class InvokerRegistry
{
-
private static final Logger log = Logger.getLogger(InvokerRegistry.class);
- private static boolean isTraceEnabled = log.isTraceEnabled();
+ private static boolean trace = log.isTraceEnabled();
private static final Map clientLocators = new HashMap();
private static final Map serverLocators = new HashMap();
@@ -209,7 +208,7 @@
{
synchronized(clientLock)
{
- if (isTraceEnabled)
+ if (trace)
{
log.trace("destroying client invoker " + locator + ", config " + configuration);
}
@@ -218,7 +217,7 @@
if(invoker != null)
{
- if (isTraceEnabled)
+ if (trace)
{
log.trace("disconnecting " + invoker);
}
@@ -262,10 +261,7 @@
ClientInvoker invoker = getRegisteredClientInvoker(locator, configuration);
if(invoker != null)
{
- if(log.isTraceEnabled())
- {
- log.trace("Found and returning cached client invoker (" + invoker + ")");
- }
+ if(trace) { log.trace("Found and returning cached client invoker (" + invoker + ")"); }
return invoker;
}
1.8.2.6 +130 -89 JBossRemoting/src/main/org/jboss/remoting/LeasePinger.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LeasePinger.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/LeasePinger.java,v
retrieving revision 1.8.2.5
retrieving revision 1.8.2.6
diff -u -b -r1.8.2.5 -r1.8.2.6
--- LeasePinger.java 21 Jan 2007 01:14:12 -0000 1.8.2.5
+++ LeasePinger.java 21 Jan 2007 08:38:32 -0000 1.8.2.6
@@ -2,9 +2,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.transport.ClientInvoker;
-import org.jboss.remoting.util.TimerUtil;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -17,45 +15,58 @@
* Internal agent class to ping the remote server to keep lease alive.
*
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
+ * @author <a href="mailto:ovidiu at ejboss.org">Ovidiu Feodorov</a>
*/
public class LeasePinger
{
+ // Constants ------------------------------------------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(LeasePinger.class);
+
+ public static final long DEFAULT_LEASE_PERIOD = 5000;
+
+ // Static ---------------------------------------------------------------------------------------
+
+ private static boolean trace = log.isTraceEnabled();
+
private static Timer timer = new Timer(true);
- private ClientInvoker client = null;
- private long pingPeriod = -1;
+ // Attributes -----------------------------------------------------------------------------------
+
private long defaultPingPeriod = -1;
- private String invokerSessionId = null;
+
+ private ClientInvoker invoker = null;
+ private String invokerSessionID = null;
+
private Map clients = new ConcurrentHashMap();
private TimerTask timerTask = null;
- private static final Logger log = Logger.getLogger(LeasePinger.class);
- private static final boolean isTraceEnabled = log.isTraceEnabled();
+ private long pingPeriod = -1;
+
+ // Constructors ---------------------------------------------------------------------------------
- public LeasePinger(ClientInvoker remotingClient, String invokerSessionId, long defaultLeasePeriod)
+ public LeasePinger(ClientInvoker invoker, String invokerSessionID, long defaultLeasePeriod)
{
- this.client = remotingClient;
+ this.invoker = invoker;
+ this.invokerSessionID = invokerSessionID;
this.pingPeriod = defaultLeasePeriod;
this.defaultPingPeriod = defaultLeasePeriod;
- this.invokerSessionId = invokerSessionId;
}
+ // Public ---------------------------------------------------------------------------------------
+
public synchronized void startPing()
{
- if(isTraceEnabled)
- {
- log.trace("Starting lease timer for client invoker with session ID " + invokerSessionId + " with ping period of " + pingPeriod);
- }
+ if(trace) { log.trace(this + " starting lease timer with ping period of " + pingPeriod); }
+
timerTask = new LeaseTimerTask();
timer.schedule(timerTask, pingPeriod, pingPeriod);
}
public synchronized void stopPing(boolean local)
{
- if(isTraceEnabled)
- {
- log.trace("Stopping lease timer for client invoker with session ID " + invokerSessionId);
- }
+ if(trace) { log.trace(this + " stopping lease timer"); }
+
if (timerTask != null)
{
timerTask.cancel();
@@ -65,8 +76,11 @@
{
try
{
- // sending null for the request map, will indicate to server that is full disconnect (for client invoker)
- client.invoke(new InvocationRequest(invokerSessionId, null, "$DISCONNECT$", null, null, null));
+ // sending null for the request map, will indicate to server that is full disconnect
+ // (for client invoker)
+ InvocationRequest ir =
+ new InvocationRequest(invokerSessionID, null, "$DISCONNECT$", null, null, null);
+ invoker.invoke(ir);
}
catch (Throwable throwable)
{
@@ -78,56 +92,17 @@
}
}
- protected synchronized void sendClientPing()
- {
- if (client != null)
- {
- try
- {
- if(isTraceEnabled)
- {
- String clientSessionIds = "";
- if(clients != null)
- {
- Collection col = clients.values();
- Iterator itr = col.iterator();
- while(itr.hasNext())
- {
- ClientHolder h = (ClientHolder)itr.next();
- clientSessionIds = clientSessionIds + h.getSessionId() + "\n";
- }
- }
- log.trace("Sending ping to server for client invoker with session ID " + invokerSessionId + ". " +
- "Currently managing lease for following clients:\n" + clientSessionIds);
- } // end trace
-
- Map clientsClone = new ConcurrentHashMap();
- clientsClone.putAll(clients);
- Map requestClients = new ConcurrentHashMap();
- requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
- client.invoke(new InvocationRequest(invokerSessionId, null, "$PING$", requestClients, null, null));
- }
- catch (Throwable throwable)
- {
- log.warn("Error sending lease ping to server for client invoker with session ID " + invokerSessionId);
- }
- }
- }
-
- public synchronized void addClient(String sessionId, Map configuration, long leasePeriod)
+ public synchronized void addClient(String sessionID, Map configuration, long leasePeriod)
{
if (leasePeriod <= 0)
{
leasePeriod = defaultPingPeriod;
}
- if(isTraceEnabled)
- {
- log.trace("Adding new client to lease for client invoker with session ID " + invokerSessionId + " where " +
- "client session ID is " + sessionId + " and lease period is " + leasePeriod);
- }
- ClientHolder newClient = new ClientHolder(sessionId, configuration, leasePeriod);
- clients.put(sessionId, newClient);
+ if(trace) { log.trace(this + " adding new client with session ID " + sessionID + " and lease period " + leasePeriod); }
+
+ ClientHolder newClient = new ClientHolder(sessionID, configuration, leasePeriod);
+ clients.put(sessionID, newClient);
sendClientPing();
@@ -135,6 +110,7 @@
if (leasePeriod < pingPeriod)
{
pingPeriod = leasePeriod;
+
// don't want to call stopPing() as that will send disconnect for client invoker
if (timerTask != null)
{
@@ -145,15 +121,14 @@
}
}
- public synchronized boolean removeClient(String sessionId, boolean local)
+ public synchronized boolean removeClient(String sessionID, boolean local)
{
boolean isLastClientLease = false;
- if(isTraceEnabled)
- {
- log.trace("Removing client with session ID " + sessionId + " from lease for client invoker with session ID " + invokerSessionId);
- }
- ClientHolder holder = (ClientHolder) clients.remove(sessionId);
+ if(trace) { log.trace(this + " removing client with session ID " + sessionID); }
+
+ ClientHolder holder = (ClientHolder)clients.remove(sessionID);
+
if (!local)
{
if (holder != null)
@@ -163,40 +138,40 @@
{
Map clientMap = new HashMap();
clientMap.put(ClientHolder.CLIENT_HOLDER_KEY, holder);
- client.invoke(new InvocationRequest(invokerSessionId, null, "$DISCONNECT$", clientMap, null, null));
- if(isTraceEnabled)
- {
- log.trace("Sent out disconnect message to server for lease tied to client session ID " + sessionId);
- }
+
+ InvocationRequest ir =
+ new InvocationRequest(this.invokerSessionID, null, "$DISCONNECT$", clientMap, null, null);
+ invoker.invoke(ir);
+
+ if(trace) { log.trace(this + " sent out disconnect message to server for lease tied to client with session ID " + sessionID); }
}
catch (Throwable throwable)
{
- log.warn("Error sending disconnect for client lease where client session ID is " + sessionId);
- }
+ log.warn(this + " failed sending disconnect for client lease for " +
+ "client with session ID " + sessionID); }
}
else
{
- log.warn("Tried to remove lease for client with session ID " + sessionId + ", but did not exist for client invoker lease (session ID " + invokerSessionId + ")");
+ log.warn(this + " tried to remove lease for client with session ID " + sessionID +
+ ", but no such lease was found");
}
}
if (clients.isEmpty())
{
isLastClientLease = true;
- if(isTraceEnabled)
- {
- log.trace("There are no more client leases tied to this client invoker's lease (session ID " + invokerSessionId + ")");
- }
+ if(trace) { log.trace(this + " has no more client leases"); }
}
else
{
- // now need to see if any of the other client holders have a lower lease period than default
+ // now need to see if any of the other client holders have a lower lease period than
+ // default
+
long tempPingPeriod = defaultPingPeriod;
- Collection clientHolders = clients.values();
- Iterator itr = clientHolders.iterator();
- while (itr.hasNext())
+
+ for (Iterator i = clients.values().iterator(); i.hasNext(); )
{
- ClientHolder clientHolder = (ClientHolder) itr.next();
+ ClientHolder clientHolder = (ClientHolder)i.next();
long clientHolderLeasePeriod = clientHolder.getLeasePeriod();
if (clientHolderLeasePeriod > 0 && clientHolderLeasePeriod < tempPingPeriod)
{
@@ -222,9 +197,75 @@
return isLastClientLease;
}
- private class LeaseTimerTask extends TimerTask
+ public synchronized long getLeasePeriod(String sessionID)
+ {
+ if (timerTask == null)
+ {
+ return -1;
+ }
+
+ // look to see if the client is still amont those serviced by this lease pinger
+ if (clients.containsKey(sessionID))
{
+ return pingPeriod;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ public String toString()
+ {
+ return "LeasePinger[" + invoker + "(" + invokerSessionID + ")]";
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ private synchronized void sendClientPing()
+ {
+ if (invoker != null)
+ {
+ try
+ {
+ if(trace)
+ {
+ String clientSessionIds = "";
+ if(clients != null)
+ {
+ for(Iterator i = clients.values().iterator(); i.hasNext(); )
+ {
+ ClientHolder h = (ClientHolder)i.next();
+ clientSessionIds = clientSessionIds + h.getSessionId() + "\n";
+ }
+ }
+
+ log.trace(this + " sending ping to server. Currently managing lease " +
+ "for following clients:\n" + clientSessionIds);
+ }
+
+ Map clientsClone = new ConcurrentHashMap(clients);
+ Map requestClients = new ConcurrentHashMap();
+ requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
+ InvocationRequest ir =
+ new InvocationRequest(invokerSessionID, null, "$PING$", requestClients, null, null);
+ invoker.invoke(ir);
+ }
+ catch (Throwable throwable)
+ {
+ log.warn(this + " failed to send lease ping to server");
+ }
+ }
+ }
+
+ // Inner classes --------------------------------------------------------------------------------
+
+ private class LeaseTimerTask extends TimerTask
+ {
public void run()
{
sendClientPing();
1.7.2.7 +15 -2 JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MicroRemoteClientInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -b -r1.7.2.6 -r1.7.2.7
--- MicroRemoteClientInvoker.java 21 Jan 2007 03:02:32 -0000 1.7.2.6
+++ MicroRemoteClientInvoker.java 21 Jan 2007 08:38:32 -0000 1.7.2.7
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
* @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
- * @version $Revision: 1.7.2.6 $
+ * @version $Revision: 1.7.2.7 $
*/
public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
{
@@ -335,6 +335,19 @@
}
}
+ public long getLeasePeriod(String sessionID)
+ {
+ synchronized(clientLeaseLock)
+ {
+ if(leasePinger == null)
+ {
+ return -1;
+ }
+
+ return leasePinger.getLeasePeriod(sessionID);
+ }
+ }
+
public void establishLease(String sessionId, Map configuration, long leasePeriod)
throws Throwable
{
@@ -371,7 +384,7 @@
if (shouldLease.booleanValue())
{
- long defaultLeasePeriod = 5000;
+ long defaultLeasePeriod = LeasePinger.DEFAULT_LEASE_PERIOD;
Map respMap = resp.getPayload();
if (respMap != null)
1.52.2.20 +11 -12 JBossRemoting/src/main/org/jboss/remoting/ServerInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ServerInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/ServerInvoker.java,v
retrieving revision 1.52.2.19
retrieving revision 1.52.2.20
diff -u -b -r1.52.2.19 -r1.52.2.20
--- ServerInvoker.java 20 Jan 2007 06:35:15 -0000 1.52.2.19
+++ ServerInvoker.java 21 Jan 2007 08:38:32 -0000 1.52.2.20
@@ -65,7 +65,7 @@
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
* @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
*
- * @version $Revision: 1.52.2.19 $
+ * @version $Revision: 1.52.2.20 $
*/
public abstract class ServerInvoker extends AbstractInvoker implements ServerInvokerMBean
{
@@ -191,6 +191,7 @@
private long leasePeriod = DEFAULT_CLIENT_LEASE_PERIOD;
private boolean leaseManagement = false;
private Map clientLeases = new HashMap();
+
protected ConnectionNotifier connectionNotifier = new ConnectionNotifier();
protected ServerSocketFactory serverSocketFactory = null;
@@ -565,7 +566,6 @@
/**
* The timeout (in milliseconds) used for the socket connection.
- * @return
*/
public int getTimeout()
{
@@ -620,32 +620,31 @@
}
/**
- * Sets the amount of time (in milliseconds) that a client should renew its lease.
- * If this value is not set, the default of five seconds (see DEFAULT_CLIENT_LEASE_PERIOD), will be used.
- * This value will also be what is given to the client when it initially querys server for leasing information.
- * If set after create() method called, this value will override value set by CLIENT_LEASE_PERIOD key.
- * @param leasePeriodValue
+ * Sets the amount of time (in milliseconds) that a client should renew its lease. If this value
+ * is not set, the default of five seconds (see DEFAULT_CLIENT_LEASE_PERIOD), will be used.
+ * This value will also be what is given to the client when it initially querys server for
+ * leasing information. If set after create() method called, this value will override value set
+ * by CLIENT_LEASE_PERIOD key.
*/
public void setLeasePeriod(long leasePeriodValue)
{
this.leasePeriod = leasePeriodValue;
- if (leasePeriod<=0)
+
+ if (leasePeriod <= 0)
{
- this.leaseManagement=false;
+ this.leaseManagement = false;
}
else
{
if(connectionNotifier != null && connectionNotifier.size() > 0)
{
- this.leaseManagement=true;
+ this.leaseManagement = true;
}
-
}
}
/**
* Gets the amount of time (in milliseconds) that a client should renew its lease.
- * @return
*/
public long getLeasePeriod()
{
More information about the jboss-cvs-commits
mailing list