[jboss-remoting-commits] JBoss Remoting SVN: r5936 - remoting2/branches/2.x/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Jul 29 16:13:05 EDT 2010


Author: ron.sigal at jboss.com
Date: 2010-07-29 16:13:05 -0400 (Thu, 29 Jul 2010)
New Revision: 5936

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-1238: Added use of leaseCreationTimeout.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2010-07-29 20:12:38 UTC (rev 5935)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java	2010-07-29 20:13:05 UTC (rev 5936)
@@ -40,6 +40,7 @@
 public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
 {
    private static final Logger log = Logger.getLogger(MicroRemoteClientInvoker.class);
+   private static final String LEASE_CREATION_TIMEOUT_DEFAULT = "30000";
    private boolean trace = log.isTraceEnabled();
 
    protected boolean connected = false;
@@ -51,6 +52,7 @@
    private String invokerSessionID = new GUID().toString();
    protected boolean parentFirstClassLoading = true;
    private boolean changeInvalidStateToCannotConnect = false;
+   private String leaseCreationTimeout = LEASE_CREATION_TIMEOUT_DEFAULT;
    
    protected List connectHomes;
 
@@ -388,6 +390,16 @@
       return this.invokerSessionID;
    }
 
+   public String getLeaseCreationTimeout()
+   {
+      return leaseCreationTimeout;
+   }
+
+   public void setLeaseCreationTimeout(String leaseCreationTimeout)
+   {
+      this.leaseCreationTimeout = leaseCreationTimeout;
+   }
+
    public void terminateLease(String sessionId, int disconnectTimeout)
    {
       terminateLease(sessionId, disconnectTimeout, null);
@@ -405,6 +417,10 @@
          if (trace) log.trace(this + " entering terminateLease() for " + leasePinger);
          if(leasePinger != null)
          {
+            if (disconnectTimeout == Client.DEFAULT_DISCONNECT_TIMEOUT)
+            {
+            	disconnectTimeout = Integer.parseInt(leaseCreationTimeout);
+            }
             leasePinger.setDisconnectTimeout(disconnectTimeout);
             
             if (sessionId == null)
@@ -506,6 +522,7 @@
                Map requestMap = new HashMap();
                requestMap.put(LeasePinger.LEASE_PINGER_ID, leasePingerId);
                requestMap.put(LeasePinger.TIME_STAMP, Long.toString(System.currentTimeMillis()));
+               requestMap.put(ServerInvoker.TIMEOUT, leaseCreationTimeout);
                if (trace) log.trace(this + " initiating lease for leasePingerId " + leasePingerId);
                InvocationRequest ir = new InvocationRequest(invokerSessionID, null, "$PING$", requestMap, new HashMap(), null);
 
@@ -619,6 +636,22 @@
          String sflag = flag.toString();
          changeInvalidStateToCannotConnect = Boolean.valueOf(sflag).booleanValue();
       }
+      
+      flag = configuration.get(Remoting.LEASE_CREATION_TIMEOUT);
+      if (flag != null)
+      {
+         String sflag = flag.toString();
+         try 
+         {
+            Integer.valueOf(sflag);
+            leaseCreationTimeout = sflag;
+         }
+         catch (NumberFormatException e)
+         {
+            log.warn(this + " value of " + Remoting.LEASE_CREATION_TIMEOUT + 
+                     " should be in numeric form: " + sflag + ", using " + LEASE_CREATION_TIMEOUT_DEFAULT);
+         }
+      }
    }
 
    /**



More information about the jboss-remoting-commits mailing list