[jboss-remoting-commits] JBoss Remoting SVN: r4242 - 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 May 28 02:43:08 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-05-28 02:43:08 -0400 (Wed, 28 May 2008)
New Revision: 4242

Modified:
   remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-986: (1) Created "connectionWait" parameter; (2) eliminated "numberOfRetries" parameter.

Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2008-05-28 06:40:31 UTC (rev 4241)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java	2008-05-28 06:43:08 UTC (rev 4242)
@@ -83,19 +83,15 @@
     */
    public static final String USE_ONEWAY_CONNECTION_TIMEOUT = "useOnewayConnectionTimeout";
 
+   /** Key for setting time to wait to get permission to get a connection */
+   public static final String CONNECTION_WAIT = "connectionWait";
+   
    /**
     * Default value for enable TCP nodelay. Value is false.
     */
    public static final boolean TCP_NODELAY_DEFAULT = false;
 
    /**
-    * Default maximum number of retries to get a valid socket from the* socket pool. This also
-    * translates to number of seconds will wait for connection to be returned to connection pool
-    * before erroring. Default is 30.
-    */
-   public static final int MAX_RETRIES = 30;
-
-   /**
     * Default maximum number of times a invocation will be made when it gets a SocketException.
     * Default is 3.
     */
@@ -108,6 +104,9 @@
 
    /** Default timeout value used by OnewayConnectionTask.  Value is 2 seconds. */
    public static final int ONEWAY_CONNECTION_TIMEOUT_DEFAULT = 2000;
+   
+   /** Default time to wait to get permission to get a connection */
+   public static final int CONNECTION_WAIT_DEFAULT = 30000;
 
    // Static ---------------------------------------------------------------------------------------
 
@@ -208,11 +207,11 @@
 
    protected String clientSocketClassName;
    protected Class clientSocketClass;
-   protected int numberOfRetries;
    protected int numberOfCallRetries;
    protected int maxPoolSize;
    protected int onewayConnectionTimeout;
    protected boolean useOnewayConnectionTimeout = true;
+   protected int connectionWait = CONNECTION_WAIT_DEFAULT;
 
    /**
     * Pool for this invoker. This is shared between all instances of proxies attached to a specific
@@ -261,7 +260,6 @@
       enableTcpNoDelay = TCP_NODELAY_DEFAULT;
       clientSocketClassName = ClientSocketWrapper.class.getName();
       clientSocketClass = null;
-      numberOfRetries = MAX_RETRIES;
       numberOfCallRetries = MAX_CALL_RETRIES;
       pool = null;
       maxPoolSize = MAX_POOL_SIZE;
@@ -407,6 +405,16 @@
       }
    }
    
+   public int getConnectionWait()
+   {
+      return connectionWait;
+   }
+
+   public void setConnectionWait(int connectionWait)
+   {
+      this.connectionWait = connectionWait;
+   }
+
    public Home getHomeInUse()
    {
       return home;
@@ -439,19 +447,13 @@
     */
    public void setNumberOfRetries(int numberOfRetries)
    {
-      if (numberOfRetries < 1)
-      {
-         this.numberOfRetries = MAX_RETRIES;
-      }
-      else
-      {
-         this.numberOfRetries = numberOfRetries;
-      }
+      log.warn("numberOfRetries is no longer used");
    }
 
    public int getNumberOfRetries()
    {
-      return numberOfRetries;
+      log.warn("numberOfRetries is no longer used");
+      return -1;
    }
 
    /**
@@ -1037,7 +1039,7 @@
       throws Exception
    {
       long start = System.currentTimeMillis();
-      long timeToWait = (timeAllowed > 0) ? timeAllowed : 30000;
+      long timeToWait = (timeAllowed > 0) ? timeAllowed : connectionWait;
       boolean timedout = !semaphore.attempt(timeToWait);
       if (trace) log.trace(this + " obtained semaphore: " + semaphore.permits());
       




More information about the jboss-remoting-commits mailing list