You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2012/09/02 13:25:54 UTC

svn commit: r1379943 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala

Author: chirino
Date: Sun Sep  2 11:25:53 2012
New Revision: 1379943

URL: http://svn.apache.org/viewvc?rev=1379943&view=rev
Log:
Avoid NPEs that can occur if we shutdown the store before the router.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala?rev=1379943&r1=1379942&r2=1379943&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala Sun Sep  2 11:25:53 2012
@@ -258,22 +258,24 @@ class VirtualHost(val broker: Broker, va
 
 
   override protected def _stop(on_completed:Task):Unit = {
-
     val tracker = new LoggingTracker("virtual host shutdown", console_log)
     tracker.stop(router);
-    if( store!=null ) {
-      val task = tracker.task("store session counter")
-      session_counter.disconnect{
-        tracker.stop(store);
-        task.run()
-      }
-    }
-    tracker.callback(dispatch_queue.runnable {
-      if( direct_buffer_allocator !=null ) {
-        direct_buffer_allocator.close
-        direct_buffer_allocator
+    tracker.callback(^{
+      val tracker = new LoggingTracker("virtual host shutdown", console_log)
+      if( store!=null ) {
+        val task = tracker.task("store session counter")
+        session_counter.disconnect{
+          tracker.stop(store);
+          task.run()
+        }
       }
-      on_completed.run()
+      tracker.callback(dispatch_queue.runnable {
+        if( direct_buffer_allocator !=null ) {
+          direct_buffer_allocator.close
+          direct_buffer_allocator
+        }
+        on_completed.run()
+      })
     })
   }