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 2011/06/08 16:13:43 UTC
svn commit: r1133411 - in /activemq/activemq-apollo/trunk:
apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/
apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/
apollo-broker/src/main/scala/org/apache/activem...
Author: chirino
Date: Wed Jun 8 14:13:43 2011
New Revision: 1133411
URL: http://svn.apache.org/viewvc?rev=1133411&view=rev
Log:
Increase dryness: Moving the common bits of constructing the StoreStatusDTO into the base class.
Modified:
activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStore.scala
activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/BDBStoreStatusDTO.java
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/DelayingStoreSupport.scala
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java
activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala
Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStore.scala?rev=1133411&r1=1133410&r2=1133411&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStore.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStore.scala Wed Jun 8 14:13:43 2011
@@ -239,24 +239,8 @@ class BDBStore(var config:BDBStoreDTO) e
def get_store_status(callback:(StoreStatusDTO)=>Unit) = dispatch_queue {
val rc = new BDBStoreStatusDTO
-
- rc.state = service_state.toString
- rc.state_since = service_state.since
-
- rc.flush_latency = flush_latency
- rc.message_load_latency = message_load_latency
+ fill_store_status(rc)
rc.message_load_batch_size = message_load_batch_size
-
-// rc.journal_append_latency = client.metric_journal_append
-// rc.index_update_latency = client.metric_index_update
-
- rc.canceled_message_counter = metric_canceled_message_counter
- rc.canceled_enqueue_counter = metric_canceled_enqueue_counter
- rc.flushed_message_counter = metric_flushed_message_counter
- rc.flushed_enqueue_counter = metric_flushed_enqueue_counter
-
- rc.pending_stores = pendingStores.size
-
callback(rc)
}
Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/BDBStoreStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/BDBStoreStatusDTO.java?rev=1133411&r1=1133410&r2=1133411&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/BDBStoreStatusDTO.java (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/BDBStoreStatusDTO.java Wed Jun 8 14:13:43 2011
@@ -41,6 +41,4 @@ public class BDBStoreStatusDTO extends S
@XmlElement(name="message_load_batch_size")
public IntMetricDTO message_load_batch_size;
- @XmlElement(name="pending_stores")
- public int pending_stores;
}
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/DelayingStoreSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/DelayingStoreSupport.scala?rev=1133411&r1=1133410&r2=1133411&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/DelayingStoreSupport.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/store/DelayingStoreSupport.scala Wed Jun 8 14:13:43 2011
@@ -23,7 +23,7 @@ import org.fusesource.hawtdispatch._
import java.util.concurrent._
import org.apache.activemq.apollo.util._
import org.fusesource.hawtdispatch.{BaseRetained, ListEventAggregator}
-import org.apache.activemq.apollo.dto.{TimeMetricDTO, IntMetricDTO}
+import org.apache.activemq.apollo.dto.{StoreStatusDTO, TimeMetricDTO, IntMetricDTO}
/**
* <p>
@@ -224,6 +224,19 @@ trait DelayingStoreSupport extends Store
var canceled_add_message:Long = 0
var canceled_enqueue:Long = 0
+ protected def fill_store_status(rc: StoreStatusDTO) {
+ rc.state = service_state.toString
+ rc.state_since = service_state.since
+
+ rc.flush_latency = flush_latency
+ rc.message_load_latency = message_load_latency
+
+ rc.canceled_message_counter = metric_canceled_message_counter
+ rc.canceled_enqueue_counter = metric_canceled_enqueue_counter
+ rc.flushed_message_counter = metric_flushed_message_counter
+ rc.flushed_enqueue_counter = metric_flushed_enqueue_counter
+ rc.pending_stores = pendingStores.size
+ }
def key(x:QueueEntryRecord) = (x.queue_key, x.entry_seq)
@@ -238,6 +251,7 @@ trait DelayingStoreSupport extends Store
var next_batch_id = new IntCounter(1)
def drain_uows = {
+ dispatch_queue.assertExecuting()
uow_source.getData.foreach { uow =>
delayedUOWs.put(uow.uow_id, uow)
@@ -307,6 +321,7 @@ trait DelayingStoreSupport extends Store
var flush_latency = flush_latency_counter(false)
def drain_flushes:Unit = {
+ dispatch_queue.assertExecuting()
if( !service_state.is_started ) {
return
@@ -329,10 +344,10 @@ trait DelayingStoreSupport extends Store
flush_latency_counter.start { end=>
flush_source.suspend
store(uows) {
+ dispatch_queue.assertExecuting()
flush_source.resume
end()
uows.foreach { uow=>
-
uow.actions.foreach { case (msg, action) =>
if( action.messageRecord !=null ) {
metric_flushed_message_counter += 1
Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java?rev=1133411&r1=1133410&r2=1133411&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java Wed Jun 8 14:13:43 2011
@@ -78,4 +78,7 @@ public abstract class StoreStatusDTO {
@XmlElement(name="flush_latency")
public TimeMetricDTO flush_latency;
+ @XmlElement(name="pending_stores")
+ public int pending_stores;
+
}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala?rev=1133411&r1=1133410&r2=1133411&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2Store.scala Wed Jun 8 14:13:43 2011
@@ -257,22 +257,8 @@ class JDBM2Store(var config:JDBM2StoreDT
def get_store_status(callback:(StoreStatusDTO)=>Unit) = dispatch_queue {
val rc = new JDBM2StoreStatusDTO
-
- rc.state = service_state.toString
- rc.state_since = service_state.since
-
- rc.flush_latency = flush_latency
- rc.message_load_latency = message_load_latency
+ fill_store_status(rc)
rc.message_load_batch_size = message_load_batch_size
-
-// rc.journal_append_latency = client.metric_journal_append
-// rc.index_update_latency = client.metric_index_update
-
- rc.canceled_message_counter = metric_canceled_message_counter
- rc.canceled_enqueue_counter = metric_canceled_enqueue_counter
- rc.flushed_message_counter = metric_flushed_message_counter
- rc.flushed_enqueue_counter = metric_flushed_enqueue_counter
-
callback(rc)
}