commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl DefaultConnectionPinger.java
Date Wed, 27 Mar 2002 20:58:24 GMT
hammant     02/03/27 12:58:24

  Modified:    altrmi/src/java/org/apache/commons/altrmi/client/impl
                        DefaultConnectionPinger.java
  Log:
  small refactor to pinger
  
  Revision  Changes    Path
  1.4       +17 -14    jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultConnectionPinger.java
  
  Index: DefaultConnectionPinger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/DefaultConnectionPinger.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultConnectionPinger.java	12 Mar 2002 17:05:19 -0000	1.3
  +++ DefaultConnectionPinger.java	27 Mar 2002 20:58:24 -0000	1.4
  @@ -22,7 +22,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.3 $
  + * @version * $Revision: 1.4 $
    */
   public class DefaultConnectionPinger implements AltrmiConnectionPinger, Runnable {
   
  @@ -98,19 +98,7 @@
           try {
               while (mContinue) {
                   Thread.sleep(mPingInterval);
  -
  -                if (mAltrmiInvocationHandler.getLastRealRequest()
  -                        > (System.currentTimeMillis() - (mGiveupInterval))) {
  -                    mAltrmiInvocationHandler.ping();
  -                } else {
  -
  -                    //TODO should be restartable after reconnect of socket.
  -
  -                    mContinue = false;
  -
  -                    // if more than 100 seconds since last request, stop pinging
  -                    // Let the server do a disconnect according to its rules.
  -                }
  +                ping();
               }
           } catch (AltrmiConnectionClosedException cce) {
               System.out.println("Pinger Connection closed");
  @@ -120,6 +108,21 @@
               System.out.println("Pinger Interrupted!");
   
               // do nothing.
  +        }
  +    }
  +
  +    private void ping() {
  +        if (mAltrmiInvocationHandler.getLastRealRequest()
  +                > (System.currentTimeMillis() - (mGiveupInterval))) {
  +            mAltrmiInvocationHandler.ping();
  +        } else {
  +
  +            //TODO should be restartable after reconnect of socket.
  +
  +            mContinue = false;
  +
  +            // if more than 100 seconds since last request, stop pinging
  +            // Let the server do a disconnect according to its rules.
           }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message