activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1443059 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/QueueEntry.scala
Date Wed, 06 Feb 2013 16:46:01 GMT
Author: chirino
Date: Wed Feb  6 16:46:01 2013
New Revision: 1443059

URL: http://svn.apache.org/viewvc?rev=1443059&view=rev
Log:
Make sure we fire the swap_out watchers if we stop swapping out an entry.

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

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/QueueEntry.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/QueueEntry.scala?rev=1443059&r1=1443058&r2=1443059&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/QueueEntry.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/QueueEntry.scala
Wed Feb  6 16:46:01 2013
@@ -504,6 +504,14 @@ class QueueEntry(val queue:Queue, val se
 
     var on_swap_out = List[()=>Unit]()
 
+    def fire_swap_out_watchers = if(!on_swap_out.isEmpty) {
+      val t = on_swap_out
+      on_swap_out = Nil
+      for ( task <- t ) {
+        task()
+      }
+    }
+
     def swapped_out(store_wrote_to_disk:Boolean) = {
       assert( state == this )
       storing = false
@@ -529,12 +537,7 @@ class QueueEntry(val queue:Queue, val se
           queue.loaded_size -= size
         }
 
-        val on_swap_out_copy = on_swap_out
-        on_swap_out = Nil
-        for ( task <- on_swap_out_copy ) {
-          task()
-        }
-
+        fire_swap_out_watchers
       } else {
         if( remove_pending ) {
           delivery.message.release
@@ -551,6 +554,7 @@ class QueueEntry(val queue:Queue, val se
         this.space += delivery
       }
       swapping_out = false
+      fire_swap_out_watchers
     }
 
     override def remove = {



Mime
View raw message