activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1207556 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Date Mon, 28 Nov 2011 20:05:03 GMT
Author: chirino
Date: Mon Nov 28 20:05:03 2011
New Revision: 1207556

URL: http://svn.apache.org/viewvc?rev=1207556&view=rev
Log:
Fixes APLO-91 : NPE occurs when a subscription is added to a queue which is in the process
of starting up.

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

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala?rev=1207556&r1=1207555&r2=1207556&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Mon Nov 28 20:05:03 2011
@@ -401,6 +401,7 @@ class Queue(val router: LocalRouter, val
                 tail_entry = new QueueEntry(Queue.this, next_message_seq)
             }
 
+            all_subscriptions.valuesIterator.foreach( _.rewind(head_entry) )
             debug("restored: " + enqueue_item_counter)
           }
           on_completed
@@ -580,10 +581,13 @@ class Queue(val router: LocalRouter, val
     }
   }
 
-  def swap_messages = {
+  def swap_messages:Unit = {
     dispatch_queue.assertExecuting()
     now = System.currentTimeMillis()
 
+    if( !service_state.is_started )
+      return
+
     var cur = entries.getHead
     while( cur!=null ) {
 
@@ -1041,9 +1045,8 @@ class QueueEntry(val queue:Queue, val se
 
   def label = state.label
 
-  def is_tail = this == queue.tail_entry
-  def is_head = this == queue.head_entry
-
+  def is_tail = as_tail!=null
+  def is_head = as_head!=null
   def is_loaded = as_loaded!=null
   def is_swapped = as_swapped!=null
   def is_swapped_range = as_swapped_range!=null



Mime
View raw message