[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...

Ovidiu Feodorov ovidiu.feodorov at jboss.com
Sat Jan 20 22:02:32 EST 2007


  User: ovidiu  
  Date: 07/01/20 22:02:32

  Modified:    src/main/org/jboss/remoting  Tag: remoting_2_x
                        MicroRemoteClientInvoker.java
  Log:
  reformatting
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.6   +60 -52    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.5
  retrieving revision 1.7.2.6
  diff -u -b -r1.7.2.5 -r1.7.2.6
  --- MicroRemoteClientInvoker.java	21 Jan 2007 01:14:50 -0000	1.7.2.5
  +++ MicroRemoteClientInvoker.java	21 Jan 2007 03:02:32 -0000	1.7.2.6
  @@ -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.5 $
  + * @version $Revision: 1.7.2.6 $
    */
   public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
   {
  @@ -218,7 +218,8 @@
       * @throws ConnectionFailedException
       *
       */
  -   protected abstract Object transport(String sessionId, Object invocation, Map metadata, Marshaller marshaller, UnMarshaller unmarshaller)
  +   protected abstract Object transport(String sessionId, Object invocation, Map metadata,
  +                                       Marshaller marshaller, UnMarshaller unmarshaller)
            throws IOException, ConnectionFailedException, ClassNotFoundException;
   
      /**
  @@ -256,22 +257,21 @@
      }
   
      /**
  -    * subclasses must implement this method to provide a hook to connect to the remote server, if this applies
  -    * to the specific transport. However, in some transport implementations, this may not make must difference since
  -    * the connection is not persistent among invocations, such as SOAP.  In these cases, the method should
  -    * silently return without any processing.
  +    * Subclasses must implement this method to provide a hook to connect to the remote server, if
  +    * this applies to the specific transport. However, in some transport implementations, this may
  +    * not make must difference since the connection is not persistent among invocations, such as
  +    * SOAP.  In these cases, the method should silently return without any processing.
       *
       * @throws ConnectionFailedException
       *
       */
  -   protected abstract void handleConnect()
  -         throws ConnectionFailedException;
  +   protected abstract void handleConnect() throws ConnectionFailedException;
   
      /**
  -    * subclasses must implement this method to provide a hook to disconnect from the remote server, if this applies
  -    * to the specific transport. However, in some transport implementations, this may not make must difference since
  -    * the connection is not persistent among invocations, such as SOAP.  In these cases, the method should
  -    * silently return without any processing.
  +    * Subclasses must implement this method to provide a hook to disconnect from the remote server,
  +    * if this applies to the specific transport. However, in some transport implementations, this
  +    * may not make must difference since the connection is not persistent among invocations, such as
  +    * SOAP. In these cases, the method should silently return without any processing.
       */
      protected abstract void handleDisconnect();
   
  @@ -335,7 +335,8 @@
         }
      }
   
  -   public void establishLease(String sessionId, Map configuration, long leasePeriod) throws Throwable
  +   public void establishLease(String sessionId, Map configuration, long leasePeriod)
  +      throws Throwable
      {
         synchronized (clientLeaseLock)
         {
  @@ -344,30 +345,38 @@
            if (leasePinger != null)
            {
               leasePinger.addClient(sessionId, configuration, leasePeriod);
  +            return;
            }
  -         else
  -         {
  +
               try
               {
                  if(trace)
                  {
  -                  log.trace("Sending initial lease ping to server for client invoker (session id " + invokerSessionId + ") to determine " +
  -                            "if server has leasing enabled.");
  +               log.trace("Sending initial lease ping to server for client invoker (session id " +
  +                          invokerSessionId + ") to determine if server has leasing enabled.");
                  }
  +
                  // configuration should NOT be passed as want ping to be specific to client invoker
                  // and NOT to the client.
  -               Object ret = invoke(new InvocationRequest(invokerSessionId, null, "$PING$", null, new HashMap(), null));
  +
  +            InvocationRequest ir =
  +               new InvocationRequest(invokerSessionId, null, "$PING$", null, new HashMap(), null);
  +
  +            Object ret = invoke(ir);
  +
                  if (ret instanceof InvocationResponse)
                  {
                     InvocationResponse resp = (InvocationResponse) ret;
  -                  Boolean shouldLease = (Boolean) resp.getResult();
  +               Boolean shouldLease = (Boolean)resp.getResult();
  +
                     if (shouldLease.booleanValue())
                     {
                        long defaultLeasePeriod = 5000;
                        Map respMap = resp.getPayload();
  +
                        if (respMap != null)
                        {
  -                        Long leaseTimeoutValue = (Long) respMap.get("clientLeasePeriod");
  +                     Long leaseTimeoutValue = (Long)respMap.get("clientLeasePeriod");
                           long serverDefaultLeasePeriod = leaseTimeoutValue.longValue();
                           if(serverDefaultLeasePeriod > 0)
                           {
  @@ -377,8 +386,10 @@
   
                        if(trace)
                        {
  -                        log.trace("Server does have leasing enabled (with default lease period of " + defaultLeasePeriod + ") and will start a new lease pinger.");
  +                     log.trace("Server does have leasing enabled (with default lease period of " +
  +                                defaultLeasePeriod + ") and will start a new lease pinger.");
                        }
  +
                        leasePinger = new LeasePinger(this, invokerSessionId, defaultLeasePeriod);
                        leasePinger.addClient(sessionId, configuration, leasePeriod);
                        leasePinger.startPing();
  @@ -387,14 +398,11 @@
               }
               catch (Throwable throwable)
               {
  -               Exception e = new Exception("Error setting up client lease.");
  +            Exception e = new Exception("Error setting up client lease");
                  e.initCause(throwable);
                  throw e;
               }
  -
  -         }
         }
  -
      }
   
      /**
  
  
  



More information about the jboss-cvs-commits mailing list