You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2007/06/26 07:36:45 UTC

svn commit: r550698 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java

Author: rajdavies
Date: Mon Jun 25 22:36:43 2007
New Revision: 550698

URL: http://svn.apache.org/viewvc?view=rev&rev=550698
Log:
fix for shutdown command

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?view=diff&rev=550698&r1=550697&r2=550698
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java Mon Jun 25 22:36:43 2007
@@ -109,7 +109,7 @@
     protected BrokerInfo brokerInfo;
     private WireFormatInfo wireFormatInfo;
     // Used to do async dispatch.. this should perhaps be pushed down into the transport layer..
-    protected final List dispatchQueue=Collections.synchronizedList(new LinkedList());
+    protected final List <Command>dispatchQueue=Collections.synchronizedList(new LinkedList<Command>());
     protected final TaskRunner taskRunner;
     protected final AtomicReference transportException = new AtomicReference();
     private boolean inServiceException=false;
@@ -200,6 +200,7 @@
 
     /**
      * Returns the number of messages to be dispatched to this connection
+     * @return size of dispatch queue
      */
     public int getDispatchQueueSize(){
         return dispatchQueue.size();
@@ -800,14 +801,12 @@
 
                  if( dispatchQueue.isEmpty() ) {
                      return false;
-                 } else {
-                     Command command = (Command) dispatchQueue.remove(0);
-                     processDispatch( command );
-                     return true;
                  }
-             } else {
-                 return false;
+                Command command = dispatchQueue.remove(0);
+                 processDispatch( command );
+                 return true;
              }
+            return false;
 
          } catch (IOException e) {
              if( dispatchStopped.compareAndSet(false, true)) {                                                                     
@@ -882,7 +881,7 @@
                     transport.oneway(new ShutdownInfo());
                 }
             }catch(Exception ignore){
-                // ignore.printStackTrace();
+                log.trace("Exception caught stopping",ignore);
             }
             transport.stop();
             active=false;
@@ -1216,9 +1215,10 @@
 	}
 
 	public Response processControlCommand(ControlCommand command) throws Exception {
-	    if (command.equals("shutdown"))
+        String control = command.getCommand();
+	    if (control != null && control.equals("shutdown"))
 	        System.exit(0);
-        return null;
+         return null;
 	}
 
 	public Response processMessageDispatch(MessageDispatch dispatch) throws Exception {