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

Ron Sigal ron_sigal at yahoo.com
Thu Feb 15 23:19:01 EST 2007


  User: rsigal  
  Date: 07/02/15 23:19:01

  Modified:    src/main/org/jboss/remoting/callback  Tag: remoting_2_x
                        CallbackPoller.java
  Log:
  JBREM-657:  Removed local paramteter from stop(), and added some logging.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.6   +17 -28    JBossRemoting/src/main/org/jboss/remoting/callback/CallbackPoller.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CallbackPoller.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/callback/CallbackPoller.java,v
  retrieving revision 1.5.2.5
  retrieving revision 1.5.2.6
  diff -u -b -r1.5.2.5 -r1.5.2.6
  --- CallbackPoller.java	21 Jan 2007 01:16:22 -0000	1.5.2.5
  +++ CallbackPoller.java	16 Feb 2007 04:19:01 -0000	1.5.2.6
  @@ -212,10 +212,11 @@
       * stop() will not return until all received callbacks have been processed
       * by the CallbackHandler and acknowledgements have been sent for all callbacks for
       * which acknowledgements have been requested.
  -    * @param local indicates that no attempt should be made to contact server
       */
  -   public synchronized void stop(boolean local)
  +   public synchronized void stop()
      {
  +      log.debug(this + " is shutting down");
  +      
         // run() and stop() are synchronized so that stop() will wait until run() has finished
         // adding any callbacks it has received to toHandleList.  Therefore, once cancel()
         // returns, no more callbacks will arrive from the server.
  @@ -233,7 +234,7 @@
         // for all callbacks for which acknowledgements have been requested.
         if (acknowledgeThread != null)
         {
  -         acknowledgeThread.shutdown(local);
  +         acknowledgeThread.shutdown();
            acknowledgeThread = null;
         }
   
  @@ -242,6 +243,8 @@
            timer.cancel();
            timer = null;
         }
  +      
  +      log.debug(this + " has shut down");
      }
   
      class HandleThread extends Thread
  @@ -325,6 +328,7 @@
          */
         protected void shutdown()
         {
  +         log.debug(this + " is shutting down");
            synchronized (toHandleList)
            {
               running = false;
  @@ -339,6 +343,7 @@
                  return;
               }
            }
  +         log.debug(this + " has shut down");
         }
      }
   
  @@ -347,7 +352,6 @@
      {
         boolean running = true;
         boolean done;
  -      boolean localShutdown;
         ArrayList toAcknowledgeListCopy = new ArrayList();
   
         AcknowledgeThread(String name)
  @@ -373,11 +377,9 @@
                     }
                  }
   
  -               // If toAcknowledgeList is empty, then running must be false.
  -               // We return only when running is false and either
  -               // 1. toAcknowledgeList is empty, or
  -               // 2. the local flag has been set by shutdown()
  -               if (toAcknowledgeList.isEmpty() || localShutdown)
  +               // If toAcknowledgeList is empty, then running must be false.  We return
  +               // only when both conditions are true.
  +               if (toAcknowledgeList.isEmpty())
                  {
                     done = true;
                     toAcknowledgeList.notify();
  @@ -400,13 +402,7 @@
                        log.trace("acknowledging: " + map.get(ServerInvokerCallbackHandler.CALLBACK_ID));
                     }
                  }
  -               
  -               // This is an attempt to stop AcknowledgeThread from contacting the server
  -               // if localShutdown has been set.  There's no guarantee, though.
  -               if (!localShutdown)
  -               {
                     client.acknowledgeCallbacks(callbackHandler, toAcknowledgeListCopy);
  -               }
                  toAcknowledgeListCopy.clear();
               }
               catch (Throwable t)
  @@ -419,9 +415,8 @@
         /**
          *  Once CallbackPoller.stop() has called AcknowledgeThread.shutdown(), HandleThread
          *  has terminated and no additional callbacks will be added to toAcknowledgeList.
  -       *  if local is false, shutdown() will not return until AcknowledgeThread has
  -       *  acknowledged all callbacks in toAcknowledgeList.  If local is true, shutdown()
  -       *  will return without waiting.
  +       *  shutdown() will not return until AcknowledgeThread has acknowledged all callbacks
  +       *  in toAcknowledgeList.
          *
          *  Either run() or shutdown() will enter its own synchronized block first.
          *
  @@ -437,21 +432,14 @@
          *     synchronized block.  After shutdown() reaches toAcknowledgeList.wait(), run()
          *     will enter its synchronized block, find running == false and toAcknowledgeList
          *     empty, and it will exit.
  -       *     
  -       * @param local if true, don't try to contact server
          */
  -      public void shutdown(boolean local)
  +      public void shutdown()
         {
  -         localShutdown = local;
  -         
  +         log.debug(this + " is shutting down");      
            synchronized (toAcknowledgeList)
            {
               running = false;
               toAcknowledgeList.notify();
  -            
  -            if (localShutdown)
  -               return;
  -            
               while (!done)
               {
                  try
  @@ -462,6 +450,7 @@
                  return;
               }
            }
  +         log.debug(this + " has shut down");
         }
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list