activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1030638 - in /activemq/activemq-apollo/trunk: ./ apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker...
Date Wed, 03 Nov 2010 20:02:44 GMT
Author: chirino
Date: Wed Nov  3 20:02:43 2010
New Revision: 1030638

URL: http://svn.apache.org/viewvc?rev=1030638&view=rev
Log:
Updates need to pickup new enhancements in hawtdispatch-1.1-SNAPSHOT

Modified:
    activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Sink.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/VirtualHost.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
    activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/RemoteConnection.scala
    activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStore.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
    activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBClient.scala
    activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStore.scala
    activemq/activemq-apollo/trunk/apollo-scala/pom.xml
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompRemoteClients.scala
    activemq/activemq-apollo/trunk/apollo-store/src/main/scala/org/apache/activemq/apollo/store/DelayingStoreSupport.scala
    activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreBenchmarkSupport.scala
    activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreFunSuiteSupport.scala
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/BaseService.scala
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/LoggingTracker.scala
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ServiceTrait.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/store/bdb/BDBStore.scala Wed Nov  3 20:02:43 2010
@@ -19,7 +19,7 @@ package org.apache.activemq.apollo.store
 import dto.{BDBStoreDTO, BDBStoreStatusDTO}
 import java.util.concurrent.atomic.AtomicLong
 import collection.Seq
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import java.io.File
 import java.util.concurrent._
 import org.apache.activemq.apollo.store._

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala Wed Nov  3 20:02:43 2010
@@ -18,7 +18,7 @@ package org.apache.activemq.apollo.broke
 
 import _root_.java.io.{File}
 import _root_.java.lang.{String}
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import _root_.org.fusesource.hawtdispatch.ScalaDispatchHelpers._
 import org.fusesource.hawtdispatch.{Dispatch}
 import org.fusesource.hawtbuf._
@@ -255,12 +255,12 @@ class Broker() extends BaseService with 
     tracker.callback(onCompleted)
   }
 
-  def getVirtualHost(name: AsciiBuffer, cb: (VirtualHost) => Unit) = reply(cb) {
+  def getVirtualHost(name: AsciiBuffer) = dispatchQueue ! {
     virtualHosts.getOrElse(name, null)
-  } >>: dispatchQueue
+  }
 
-  def getDefaultVirtualHost(cb: (VirtualHost) => Unit) = reply(cb) {
+  def getDefaultVirtualHost = dispatchQueue ! {
     defaultVirtualHost
-  } >>: dispatchQueue
+  }
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ConfigStore.scala Wed Nov  3 20:02:43 2010
@@ -20,7 +20,7 @@ import org.apache.activemq.apollo.broker
 import org.apache.activemq.apollo.dto.{XmlCodec, ConnectorDTO, VirtualHostDTO, BrokerDTO}
 import java.util.regex.Pattern
 import javax.xml.stream.{XMLOutputFactory, XMLInputFactory}
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import _root_.org.fusesource.hawtdispatch.ScalaDispatchHelpers._
 import java.util.concurrent.{TimeUnit, ExecutorService, Executors}
 import org.fusesource.hawtbuf.{ByteArrayInputStream, ByteArrayOutputStream}
@@ -28,12 +28,19 @@ import javax.xml.bind.{Marshaller, JAXBC
 import java.io.{OutputStreamWriter, File}
 import XmlCodec._
 import org.apache.activemq.apollo.util._
+import scala.util.continuations._
+import org.fusesource.hawtdispatch.DispatchQueue
 
 object ConfigStore {
 
   var store:ConfigStore = null
 
-  def apply() = store
+  def apply():ConfigStore = store
+
+  def sync[T] (func: ConfigStore=>T):T = store.dispatchQueue.sync {
+    func(store)
+  }
+
   def update(value:ConfigStore) = store=value
 
 }
@@ -47,15 +54,15 @@ object ConfigStore {
  */
 trait ConfigStore extends Service {
 
-  def listBrokers(cb: (List[String]) => Unit):Unit
+  def listBrokers: List[String]
 
-  def getBroker(id:String, eval:Boolean)(cb: (Option[BrokerDTO]) => Unit):Unit
+  def getBroker(id:String, eval:Boolean): Option[BrokerDTO]
 
-  def putBroker(config:BrokerDTO)(cb: (Boolean) => Unit):Unit
+  def putBroker(config:BrokerDTO): Boolean
 
-  def removeBroker(id:String, rev:Int)(cb: (Boolean) => Unit):Unit
+  def removeBroker(id:String, rev:Int): Boolean
 
-  def foreachBroker(eval:Boolean)(cb: (BrokerDTO)=> Unit):Unit
+  def dispatchQueue:DispatchQueue
 
 }
 
@@ -96,6 +103,12 @@ class FileConfigStore extends ConfigStor
     })
   }
 
+  protected def _stop(onCompleted:Runnable) = {
+    ioWorker.submit(^{
+      onCompleted.run
+      ioWorker.shutdown
+    })
+  }
 
   def startup(onCompleted:Runnable) = {
 
@@ -142,32 +155,22 @@ class FileConfigStore extends ConfigStor
         onCompleted.run
       }
   }
-  protected def _stop(onCompleted:Runnable) = {
-    ioWorker.submit(^{
-      onCompleted.run
-    })
-    ioWorker.shutdown
-  }
 
-  def listBrokers(cb: (List[String]) => Unit) = reply(cb) {
+                  
+  def listBrokers = {
     List(latest.id)
-  } >>: dispatchQueue
-
-
-  def foreachBroker(eval:Boolean)(cb: (BrokerDTO)=> Unit) = reply(cb) {
-    unmarshall(latest.data, eval)
-  } >>: dispatchQueue
+  }
 
 
-  def getBroker(id:String, eval:Boolean)(cb: (Option[BrokerDTO]) => Unit) = reply(cb) {
+  def getBroker(id:String, eval:Boolean) = {
     if( latest.id == id ) {
       Some(unmarshall(latest.data, eval))
     } else {
       None
     }
-  } >>: dispatchQueue
+  }
 
-  def putBroker(config:BrokerDTO)(cb: (Boolean) => Unit) = reply(cb) {
+  def putBroker(config:BrokerDTO) = {
     debug("storing broker model: %s ver %d", config.id, config.rev)
     if( latest.id != config.id ) {
       debug("this store can only update broker: "+latest.id)
@@ -179,26 +182,30 @@ class FileConfigStore extends ConfigStor
       latest = write(StoredBrokerModel(config))
       true
     }
-  } >>: dispatchQueue
+  }
 
-  def removeBroker(id:String, rev:Int)(cb: (Boolean) => Unit) = reply(cb) {
+  def removeBroker(id:String, rev:Int) = {
     // not supported.
     false
-  } >>: dispatchQueue
+  }
 
   private def fileRev(rev:Int) = new File(file.getParent, file.getName+"."+rev)
 
   private def schedualNextUpdateCheck:Unit = dispatchQueue.after(1, TimeUnit.SECONDS) {
     if( serviceState.isStarted ) {
+      val latestHash = latest.hash+1
+      val nextRev = latest.rev+1
       ioWorker {
         try {
-          val config = read(latest.rev+1, file)
-          if (latest.hash != config.hash) {
+          val config = read(nextRev, file)
+          if (latestHash != config.hash) {
             // TODO: do this in the controller so that it
             // has a chance to update the runtime too.
             val c = unmarshall(config.data)
             c.rev = config.rev
-            putBroker(c) { x=> }
+            dispatchQueue {
+              putBroker(c)
+            }
           }
           schedualNextUpdateCheck
         }
@@ -248,4 +255,4 @@ class FileConfigStore extends ConfigStor
   }
 }
 
-object FileConfigStore extends Log
\ No newline at end of file
+object FileConfigStore extends Log

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala Wed Nov  3 20:02:43 2010
@@ -18,7 +18,7 @@ package org.apache.activemq.apollo.broke
 
 import _root_.java.io.{IOException}
 import _root_.java.lang.{String}
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import protocol.{ProtocolHandler}
 import org.apache.activemq.apollo.transport.{DefaultTransportListener, Transport}
 import org.apache.activemq.apollo.util.{Log, BaseService}

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala Wed Nov  3 20:02:43 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.apollo.broker
 
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.fusesource.hawtdispatch.{Dispatch}
 import org.apache.activemq.apollo.dto.{ConnectorDTO}
 import protocol.{ProtocolFactory, Protocol}
@@ -167,4 +167,4 @@ class Connector(val broker:Broker, val i
     }
   } |>>: dispatchQueue
 
-}
\ No newline at end of file
+}

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=1030638&r1=1030637&r2=1030638&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 Wed Nov  3 20:02:43 2010
@@ -18,7 +18,7 @@ package org.apache.activemq.apollo.broke
 
 import java.util.concurrent.TimeUnit
 
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import _root_.org.fusesource.hawtdispatch.ScalaDispatchHelpers._
 import java.util.concurrent.atomic.AtomicInteger
 
@@ -1611,4 +1611,4 @@ class PrefetchingSubscription(queue:Queu
     assert(prefetched_size == 0, "inconsistent prefetch size.")
   }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala Wed Nov  3 20:02:43 2010
@@ -19,7 +19,7 @@ package org.apache.activemq.apollo.broke
 import _root_.java.util.concurrent.atomic.AtomicLong
 import _root_.org.fusesource.hawtbuf._
 import _root_.org.fusesource.hawtdispatch._
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import _root_.org.fusesource.hawtdispatch.ScalaDispatchHelpers._
 
 import collection.JavaConversions

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Sink.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Sink.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Sink.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Sink.scala Wed Nov  3 20:02:43 2010
@@ -17,7 +17,7 @@
 package org.apache.activemq.apollo.broker
 
 import _root_.org.fusesource.hawtdispatch._
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import java.util.{LinkedList}
 import org.apache.activemq.apollo.transport.Transport
 

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=1030638&r1=1030637&r2=1030638&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 Wed Nov  3 20:02:43 2010
@@ -18,9 +18,8 @@ package org.apache.activemq.apollo.broke
 
 import _root_.java.util.{ArrayList, HashMap}
 import _root_.java.lang.{String}
-import _root_.org.fusesource.hawtdispatch.{ScalaDispatch, DispatchQueue}
 import _root_.scala.collection.JavaConversions._
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 
 import org.apache.activemq.apollo.dto.{VirtualHostDTO}
 import java.util.concurrent.TimeUnit
@@ -79,7 +78,7 @@ class VirtualHost(val broker: Broker, va
   import VirtualHost._
   
   override protected def log = VirtualHost
-  override val dispatchQueue:DispatchQueue = ScalaDispatch.createQueue("virtual-host");
+  override val dispatchQueue:DispatchQueue = org.fusesource.hawtdispatch.createQueue("virtual-host");
 
   var config:VirtualHostDTO = _
   val router = new Router(this)

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/MultiProtocol.scala Wed Nov  3 20:02:43 2010
@@ -25,7 +25,7 @@ import java.nio.ByteBuffer
 import java.io.IOException
 import java.lang.String
 import java.util.concurrent.TimeUnit
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 
 /**
  * <p>

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/RemoteConnection.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/RemoteConnection.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/RemoteConnection.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/RemoteConnection.scala Wed Nov  3 20:02:43 2010
@@ -21,7 +21,7 @@ import org.apache.activemq.apollo.util.m
 import org.apache.activemq.apollo.broker.{Destination, Delivery, Connection}
 import java.util.concurrent.atomic.{AtomicBoolean, AtomicLong}
 import java.util.concurrent.TimeUnit
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import java.io.IOException
 import org.apache.activemq.apollo.transport.TransportFactory
 
@@ -140,4 +140,4 @@ abstract class RemoteProducer extends Re
     }
   }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStore.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStore.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/store/cassandra/CassandraStore.scala Wed Nov  3 20:02:43 2010
@@ -23,7 +23,7 @@ import collection.mutable.ListBuffer
 import java.util.HashMap
 import collection.{JavaConversions, Seq}
 import com.shorrockin.cascal.utils.Conversions._
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.fusesource.hawtdispatch.ListEventAggregator
 import java.util.concurrent._
 import org.apache.activemq.apollo.dto._

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala Wed Nov  3 20:02:43 2010
@@ -31,7 +31,7 @@ import org.mortbay.jetty.webapp.WebAppCo
 import org.apache.commons.logging.LogFactory
 import org.apache.activemq.apollo.broker.{BrokerRegistry, Broker, ConfigStore, FileConfigStore}
 import org.apache.activemq.apollo.util.ServiceControl
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import Helper._
 
 /**
@@ -90,21 +90,22 @@ class Run extends Action {
       store.file = conf
       ConfigStore() = store
       store.start(^{
-
-        // Brokers startup async.
-        store.foreachBroker(true) { config=>
-          // Only start the broker up if it's enabled..
-          if( config.enabled ) {
-            println("Starting broker '%s'...".format(config.id));
-            val broker = new Broker()
-            broker.config = config
-            BrokerRegistry.add(config.id, broker)
-            broker.start(^{
-              println("Broker '%s' started.".format(config.id));
-            })
+        store.dispatchQueue {
+          store.listBrokers.foreach { id=>
+            store.getBroker(id, true).foreach{ config=>
+              // Only start the broker up if it's enabled..
+              if( config.enabled ) {
+                println("Starting broker '%s'...".format(config.id));
+                val broker = new Broker()
+                broker.config = config
+                BrokerRegistry.add(config.id, broker)
+                broker.start(^{
+                  println("Broker '%s' started.".format(config.id));
+                })
+              }
+            }
           }
         }
-
       })
 
 
@@ -142,4 +143,4 @@ class Run extends Action {
 //    server.stop
 //  }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBClient.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBClient.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBClient.scala Wed Nov  3 20:02:43 2010
@@ -28,7 +28,7 @@ import org.fusesource.hawtdb.internal.jo
 import org.apache.activemq.apollo.store.hawtdb.model.Type._
 import org.apache.activemq.apollo.store.hawtdb.model._
 import org.fusesource.hawtbuf._
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import collection.mutable.{LinkedHashMap, HashMap, ListBuffer}
 import collection.JavaConversions
 import ju.{TreeSet, HashSet}
@@ -1083,4 +1083,4 @@ class HawtDBClient(hawtDBStore: HawtDBSt
     lastUpdate.compareTo(location) < 0
   }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStore.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStore.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStore.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/store/hawtdb/HawtDBStore.scala Wed Nov  3 20:02:43 2010
@@ -19,7 +19,7 @@ package org.apache.activemq.apollo.store
 import collection.mutable.ListBuffer
 import java.util.HashMap
 import collection.{Seq}
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import java.io.File
 import java.util.concurrent._
 import atomic.{AtomicInteger, AtomicLong}

Modified: activemq/activemq-apollo/trunk/apollo-scala/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-scala/pom.xml?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-scala/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-scala/pom.xml Wed Nov  3 20:02:43 2010
@@ -93,7 +93,9 @@
             <jvmArg>-Xss8m</jvmArg>
           </jvmArgs>
           <args>
+            <arg>-optimise</arg>
             <arg>-deprecation</arg>
+            <arg>-P:continuations:enable</arg>
           </args>
           <scalaVersion>${scala-version}</scalaVersion>
           <compilerPlugins>
@@ -135,7 +137,7 @@
           <plugin>
             <groupId>org.scala-tools</groupId>
             <artifactId>maven-scala-plugin</artifactId>
-            <version>${scala-plugin-version}</version>
+            <version>${maven-scala-plugin-version}</version>
             <executions>
               <execution>
                 <id>doc</id>

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala Wed Nov  3 20:02:43 2010
@@ -19,7 +19,7 @@ package org.apache.activemq.apollo.stomp
 import _root_.org.fusesource.hawtdispatch.{DispatchQueue, BaseRetained}
 import _root_.org.fusesource.hawtbuf._
 import collection.mutable.{ListBuffer, HashMap}
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 
 import AsciiBuffer._
 import org.apache.activemq.apollo.broker._
@@ -36,6 +36,7 @@ import org.apache.activemq.apollo.util._
 import java.util.concurrent.TimeUnit
 import java.util.Map.Entry
 import org.apache.activemq.apollo.dto.{StompConnectionStatusDTO, BindingDTO, DurableSubscriptionBindingDTO, PointToPointBindingDTO}
+import scala.util.continuations._
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -477,6 +478,8 @@ class StompProtocolHandler extends Proto
 
   def on_stomp_connect(headers:HeaderMap):Unit = {
 
+
+
     login = get(headers, LOGIN)
     passcode = get(headers, PASSCODE)
 
@@ -528,39 +531,36 @@ class StompProtocolHandler extends Proto
         return
     }
 
-    suspendRead("virtual host lookup")
-    val host_header = get(headers, HOST)
-    val cb: (VirtualHost)=>Unit = (host)=>
-      queue {
-        if(host!=null) {
-          this.host=host
-
-          val outbound_heart_beat_header = ascii("%d,%d".format(outbound_heartbeat,inbound_heartbeat))
-          session_id = ascii(this.host.config.id + ":"+this.host.session_counter.incrementAndGet)
-
-          connection_sink.offer(
-            StompFrame(CONNECTED, List(
-              (VERSION, protocol_version),
-              (SESSION, session_id),
-              (HEART_BEAT, outbound_heart_beat_header)
-            )))
-
-          if( this.host.direct_buffer_pool!=null ) {
-            val wf = connection.transport.getProtocolCodec.asInstanceOf[StompCodec]
-            wf.memory_pool = this.host.direct_buffer_pool
-          }
-          resumeRead
-
-        } else {
-          die("Invalid virtual host: "+host_header.get)
+    reset {
+      suspendRead("virtual host lookup")
+      val host_header = get(headers, HOST)
+      val host = host_header match {
+        case None=>
+          connection.connector.broker.getDefaultVirtualHost
+        case Some(host)=>
+          connection.connector.broker.getVirtualHost(host)
+      }
+      resumeRead
+      if(host!=null) {
+        this.host=host
+
+        val outbound_heart_beat_header = ascii("%d,%d".format(outbound_heartbeat,inbound_heartbeat))
+        session_id = ascii(this.host.config.id + ":"+this.host.session_counter.incrementAndGet)
+
+        connection_sink.offer(
+          StompFrame(CONNECTED, List(
+            (VERSION, protocol_version),
+            (SESSION, session_id),
+            (HEART_BEAT, outbound_heart_beat_header)
+          )))
+
+        if( this.host.direct_buffer_pool!=null ) {
+          val wf = connection.transport.getProtocolCodec.asInstanceOf[StompCodec]
+          wf.memory_pool = this.host.direct_buffer_pool
         }
+      } else {
+        die("Invalid virtual host: "+host_header.get)
       }
-
-    host_header match {
-      case None=>
-        connection.connector.broker.getDefaultVirtualHost(cb)
-      case Some(host)=>
-        connection.connector.broker.getVirtualHost(host, cb)
     }
 
   }

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompRemoteClients.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompRemoteClients.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompRemoteClients.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/perf/StompRemoteClients.scala Wed Nov  3 20:02:43 2010
@@ -28,7 +28,7 @@ import _root_.org.fusesource.hawtbuf._
 import AsciiBuffer._
 import Stomp._
 import _root_.org.apache.activemq.apollo.stomp.StompFrame
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 
 
 class StompRemoteConsumer extends RemoteConsumer {

Modified: activemq/activemq-apollo/trunk/apollo-store/src/main/scala/org/apache/activemq/apollo/store/DelayingStoreSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-store/src/main/scala/org/apache/activemq/apollo/store/DelayingStoreSupport.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-store/src/main/scala/org/apache/activemq/apollo/store/DelayingStoreSupport.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-store/src/main/scala/org/apache/activemq/apollo/store/DelayingStoreSupport.scala Wed Nov  3 20:02:43 2010
@@ -19,7 +19,7 @@ package org.apache.activemq.apollo.store
 import collection.mutable.ListBuffer
 import java.util.HashMap
 import collection.Seq
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import java.util.concurrent._
 import org.apache.activemq.apollo.util._
 import org.fusesource.hawtdispatch.{BaseRetained, ListEventAggregator}

Modified: activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreBenchmarkSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreBenchmarkSupport.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreBenchmarkSupport.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreBenchmarkSupport.scala Wed Nov  3 20:02:43 2010
@@ -17,7 +17,7 @@
 package org.apache.activemq.apollo.store
 
 import org.fusesource.hawtbuf.AsciiBuffer._
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.fusesource.hawtdispatch.TaskTracker
 import java.util.concurrent.{TimeUnit, CountDownLatch}
 import org.scalatest.{BeforeAndAfterEach, BeforeAndAfterAll}

Modified: activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreFunSuiteSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreFunSuiteSupport.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreFunSuiteSupport.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-store/src/test/scala/org/apache/activemq/apollo/store/StoreFunSuiteSupport.scala Wed Nov  3 20:02:43 2010
@@ -17,7 +17,7 @@
 package org.apache.activemq.apollo.store
 
 import org.fusesource.hawtbuf.AsciiBuffer._
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.fusesource.hawtdispatch.TaskTracker
 import java.util.concurrent.{TimeUnit, CountDownLatch}
 import org.scalatest.{BeforeAndAfterEach, BeforeAndAfterAll}

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/BaseService.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/BaseService.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/BaseService.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/BaseService.scala Wed Nov  3 20:02:43 2010
@@ -17,7 +17,7 @@
 package org.apache.activemq.apollo.util
 
 import org.fusesource.hawtdispatch.DispatchQueue
-import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 
 object BaseService extends Log
 

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala Wed Nov  3 20:02:43 2010
@@ -229,7 +229,7 @@ trait Logging {
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
 trait DispatchLogging extends Logging {
-  import org.fusesource.hawtdispatch.ScalaDispatch._
+  import org.fusesource.hawtdispatch._
 
   override protected def log_map(message:String) = {
     val d = getCurrentQueue
@@ -240,4 +240,4 @@ trait DispatchLogging extends Logging {
     }
   }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/LoggingTracker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/LoggingTracker.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/LoggingTracker.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/LoggingTracker.scala Wed Nov  3 20:02:43 2010
@@ -18,7 +18,7 @@ package org.apache.activemq.apollo.util
 
 import java.util.concurrent.{CountDownLatch, TimeUnit}
 import java.util.HashSet
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.fusesource.hawtdispatch.{TaskTracker, DispatchQueue}
 
 /**

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ServiceTrait.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ServiceTrait.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ServiceTrait.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ServiceTrait.scala Wed Nov  3 20:02:43 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.apollo.util
 
-import org.fusesource.hawtdispatch.ScalaDispatch
+import org.fusesource.hawtdispatch._
 
 /**
  * <p>
@@ -27,11 +27,11 @@ import org.fusesource.hawtdispatch.Scala
 trait ServiceTrait extends Service {
 
   def start(func: =>Unit ):Unit = {
-    start( ScalaDispatch.runnable( func _ ) )
+    start( runnable( func _ ) )
   }
 
   def stop(func: =>Unit ):Unit = {
-    stop( ScalaDispatch.runnable( func _ ) )
+    stop( runnable( func _ ) )
   }
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala Wed Nov  3 20:02:43 2010
@@ -20,6 +20,7 @@ import java.io.File
 import org.apache.activemq.apollo.util._
 import javax.servlet.{ServletContextListener, ServletContextEvent}
 import org.apache.activemq.apollo.broker.{FileConfigStore, ConfigStore, BrokerRegistry, Broker}
+import org.fusesource.hawtdispatch._
 
 /**
  * A servlet context listener which handles starting the
@@ -36,20 +37,21 @@ class ApolloListener extends ServletCont
       if( ConfigStore() == null ) {
         configStore = createConfigStore
         ConfigStore() = configStore
-
-        // Brokers startup async.
-        configStore.foreachBroker(true) { config=>
-          println("Config store contained broker: "+config.id);
-
-          // Only start the broker up if it's enabled..
-          if( config.enabled ) {
-
-            println("starting broker: "+config.id);
-            val broker = new Broker()
-            broker.config = config
-            BrokerRegistry.add(config.id, broker)
-            broker.start()
-
+        configStore.dispatchQueue {
+          configStore.listBrokers.foreach { id=>
+            configStore.getBroker(id, true).foreach{ config=>
+
+              println("Config store contained broker: "+config.id);
+              // Only start the broker up if it's enabled..
+              if( config.enabled ) {
+
+                println("starting broker: "+config.id);
+                val broker = new Broker()
+                broker.config = config
+                BrokerRegistry.add(config.id, broker)
+                broker.start()
+              }
+            }
           }
         }
       }
@@ -62,11 +64,12 @@ class ApolloListener extends ServletCont
   def contextDestroyed(sce: ServletContextEvent) = {
     val tracker = new LoggingTracker("webapp shutdown")
     if( configStore!=null ) {
-      configStore.foreachBroker(false) { config=>
-        // remove started brokers what we configured..
-        val broker = BrokerRegistry.remove(config.id);
-        if( broker!=null ) {
-          tracker.stop(broker)
+      configStore.dispatchQueue {
+        configStore.listBrokers.foreach { id=>
+          val broker = BrokerRegistry.remove(id);
+          if( broker!=null ) {
+            tracker.stop(broker)
+          }
         }
       }
       tracker.stop(configStore)
@@ -85,4 +88,4 @@ class ApolloListener extends ServletCont
   }
 
 
-}
\ No newline at end of file
+}

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/ConfigurationResource.scala Wed Nov  3 20:02:43 2010
@@ -18,7 +18,7 @@ package org.apache.activemq.apollo.web.r
 
 import javax.ws.rs._
 import core.{UriInfo, Response, Context}
-import org.fusesource.hawtdispatch.Future
+import org.fusesource.hawtdispatch._
 import Response.Status._
 import Response._
 import java.net.URI
@@ -32,13 +32,10 @@ import org.apache.activemq.apollo.broker
 @Produces(Array("application/json", "application/xml","text/xml", "text/html;qs=5"))
 case class ConfigurationResource(parent:BrokerResource) extends Resource(parent) {
 
-
-  def store = ConfigStore()
-
   lazy val config = {
-    Future[Option[BrokerDTO]] { cb=>
-      store.getBroker(parent.id, false)(cb)
-    }.getOrElse(result(NOT_FOUND))
+    ConfigStore.sync{ store=>
+      store.getBroker(parent.id, false).getOrElse(result(NOT_FOUND))
+    }
   }
 
 
@@ -66,16 +63,16 @@ case class ConfigurationResource(parent:
   def put(@PathParam("rev") rev:Int, config:BrokerDTO) = {
     config.id = parent.id;
     config.rev = rev
-    Future[Boolean] { cb=>
-      store.putBroker(config)(cb)
-    } || result(NOT_FOUND)
+    ConfigStore.sync { store=>
+      store.putBroker(config) || result(NOT_FOUND)
+    }
   }
 
   @DELETE @Path("{rev}")
   def delete(@PathParam("rev") rev:Int) = {
-    Future[Boolean] { cb=>
-      store.removeBroker(parent.id, rev)(cb)
-    } || result(NOT_FOUND)
+    ConfigStore.sync { store=>
+      store.removeBroker(parent.id, rev) || result(NOT_FOUND)
+    }
   }
 
 }

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala Wed Nov  3 20:02:43 2010
@@ -22,7 +22,6 @@ import javax.ws.rs._
 import core.{UriInfo, Response, Context}
 import reflect.{BeanProperty}
 import com.sun.jersey.api.view.ImplicitProduces
-import org.fusesource.hawtdispatch.Future
 import Response._
 import Response.Status._
 import org.apache.activemq.apollo.broker.ConfigStore
@@ -34,6 +33,7 @@ import java.util.concurrent.TimeUnit
 import org.apache.activemq.apollo.dto._
 import java.util.{Arrays, Collections}
 import org.apache.activemq.apollo.util.Logging
+import org.fusesource.hawtdispatch._
 
 /**
  * Defines the default representations to be used on resources
@@ -136,10 +136,11 @@ class RootResource() extends Resource {
   @GET
   def brokers = {
     val rc = new StringIdListDTO
-    Future[List[String]] { cb=>
-      ConfigStore().listBrokers(cb)
-    }.foreach { x=> 
-      rc.items.add( new StringIdLabeledDTO(x,x) )
+    val cs = ConfigStore()
+    cs.dispatchQueue.sync {
+      cs.listBrokers.foreach { x=>
+        rc.items.add( new StringIdLabeledDTO(x,x) )
+      }
     }
     rc
   }
@@ -157,12 +158,13 @@ case class BrokerResource(parent:RootRes
 
   @GET
   def get = {
+    val cs = ConfigStore()
     val rc = new BrokerSummaryDTO
     rc.id = id
     rc.manageable = BrokerRegistry.get(id)!=null
-    rc.configurable = Future[Option[BrokerDTO]] { cb=>
-        ConfigStore().getBroker(id, false)(cb)
-      }.isDefined
+    rc.configurable = cs.dispatchQueue.sync{
+      cs.getBroker(id,false).isDefined
+    }
     rc
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala Wed Nov  3 20:02:43 2010
@@ -23,8 +23,7 @@ import java.util.List
 import org.apache.activemq.apollo.dto._
 import java.{lang => jl}
 import collection.JavaConversions
-import org.fusesource.hawtdispatch.{ScalaDispatch, Future}
-import ScalaDispatch._
+import org.fusesource.hawtdispatch._
 import org.apache.activemq.apollo.broker._
 import collection.mutable.ListBuffer
 

Modified: activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala Wed Nov  3 20:02:43 2010
@@ -17,10 +17,9 @@
 package org.apache.activemq.apollo.web
 
 import java.io.File
-import java.util.concurrent.{TimeUnit, CountDownLatch}
-import org.fusesource.hawtdispatch.Future
 import org.apache.activemq.apollo.util._
 import org.apache.activemq.apollo.broker.FileConfigStore
+import org.fusesource.hawtdispatch._
 
 /**
  * <p>
@@ -40,8 +39,8 @@ class FileConfigStoreTest extends FunSui
     }
 
     expect(List("default")) {
-      Future[List[String]]{ x=>
-        store.listBrokers(x)
+      store.dispatchQueue.sync {
+        store.listBrokers
       }
     }
 

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1030638&r1=1030637&r2=1030638&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Wed Nov  3 20:02:43 2010
@@ -97,7 +97,7 @@
     <xbean-version>3.4</xbean-version>
     <felix-version>1.0.0</felix-version>
 
-    <hawtdispatch-version>1.0</hawtdispatch-version>
+    <hawtdispatch-version>1.1-SNAPSHOT</hawtdispatch-version>
     <hawtdb-version>1.6-SNAPSHOT</hawtdb-version>
     <hawtbuf-version>1.3-SNAPSHOT</hawtbuf-version>
     



Mime
View raw message