activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r887687 - in /activemq/sandbox/activemq-apollo-actor: activemq-broker/src/main/java/org/apache/activemq/apollo/ activemq-broker/src/main/java/org/apache/activemq/apollo/broker/ activemq-broker/src/test/java/org/apache/activemq/broker/ activ...
Date Sun, 06 Dec 2009 14:40:36 GMT
Author: chirino
Date: Sun Dec  6 14:40:34 2009
New Revision: 887687

URL: http://svn.apache.org/viewvc?rev=887687&view=rev
Log:
Another round of renaming

Added:
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatcher.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherAware.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherFactory.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherObserver.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatcher.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatcher.java
Removed:
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatch.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchAware.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchFactory.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchObserver.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatchSPI.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatchSPI.java
Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/Connection.java
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerQueueStore.java
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
    activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/SharedQueueTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchSystem.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/SerialDispatchQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatchContext.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatcherThread.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/GlobalDispatchQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/DispatcherThread.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/GlobalDispatchQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/TimerThread.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/actor/ActorTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/DispatchSystemTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/internal/advanced/DispatcherPoolTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java
    activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-openwire/src/test/java/org/apache/activemq/perf/broker/SharedQueuePerfTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/AbstractFlowQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IFlowQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/PartitionedQueue.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/AbstractTestConnection.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBroker.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBrokerTest.java
    activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockClient.java
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/DispatchableTransport.java
    activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/pipe/PipeTransportFactory.java

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/Connection.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/Connection.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/Connection.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/Connection.java Sun Dec  6 14:40:34 2009
@@ -25,7 +25,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.activemq.Service;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.transport.DispatchableTransport;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportListener;
@@ -42,7 +42,7 @@
     protected int inputResumeThreshold = 512 * 1024;
     protected boolean useAsyncWriteThread = true;
 
-    private Dispatch dispatcher;
+    private Dispatcher dispatcher;
     private final AtomicBoolean stopping = new AtomicBoolean();
     private ExecutorService blockingWriter;
     private ExceptionListener exceptionListener;
@@ -170,11 +170,11 @@
         this.priorityLevels = priorityLevels;
     }
 
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/Broker.java Sun Dec  6 14:40:34 2009
@@ -25,9 +25,9 @@
 
 import org.apache.activemq.Service;
 import org.apache.activemq.apollo.Connection;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
-import org.apache.activemq.dispatch.DispatchAware;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
+import org.apache.activemq.dispatch.DispatcherAware;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportAcceptListener;
 import org.apache.activemq.transport.TransportServer;
@@ -51,7 +51,7 @@
 
     private final LinkedHashMap<AsciiBuffer, VirtualHost> virtualHosts = new LinkedHashMap<AsciiBuffer, VirtualHost>();
     private VirtualHost defaultVirtualHost;
-    private Dispatch dispatcher;
+    private Dispatcher dispatcher;
     private File dataDirectory;
 
     private final class BrokerAcceptListener implements TransportAcceptListener {
@@ -129,7 +129,7 @@
 		// apply some default configuration to this broker instance before it's started.
 		if( dispatcher == null ) {
 			int threads = Runtime.getRuntime().availableProcessors();
-			dispatcher = DispatchFactory.create(getName(), threads);
+			dispatcher = DispatcherFactory.create(getName(), threads);
 		}
 		
 
@@ -376,10 +376,10 @@
     // /////////////////////////////////////////////////////////////////
     // Property Accessors
     // /////////////////////////////////////////////////////////////////
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
     	assertInConfigurationState();
         this.dispatcher = dispatcher;
     }
@@ -417,8 +417,8 @@
     
 	private void startTransportServer(TransportServer server) throws Exception {
 		server.setAcceptListener(new BrokerAcceptListener());
-		if (server instanceof DispatchAware ) {
-			((DispatchAware) server).setDispatcher(dispatcher);
+		if (server instanceof DispatcherAware ) {
+			((DispatcherAware) server).setDispatcher(dispatcher);
 		}
 		server.start();
 	}

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerDatabase.java Sun Dec  6 14:40:34 2009
@@ -40,8 +40,8 @@
 import org.apache.activemq.broker.store.Store.QueueQueryResult;
 import org.apache.activemq.broker.store.Store.QueueRecord;
 import org.apache.activemq.broker.store.Store.Session;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchAware;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherAware;
 import org.apache.activemq.flow.AbstractLimitedFlowResource;
 import org.apache.activemq.flow.Flow;
 import org.apache.activemq.flow.FlowController;
@@ -60,7 +60,7 @@
 import org.apache.activemq.util.list.LinkedNode;
 import org.apache.activemq.util.list.LinkedNodeList;
 
-public class BrokerDatabase extends AbstractLimitedFlowResource<BrokerDatabase.OperationBase<?>> implements Service, DispatchAware {
+public class BrokerDatabase extends AbstractLimitedFlowResource<BrokerDatabase.OperationBase<?>> implements Service, DispatcherAware {
 
     private static final boolean DEBUG = false;
 
@@ -71,7 +71,7 @@
     private final FlowController<OperationBase<?>> storeController;
     private final int FLUSH_QUEUE_SIZE = 10000 * 1024;
 
-    private Dispatch dispatcher;
+    private Dispatcher dispatcher;
     private Thread flushThread;
     private AtomicBoolean running = new AtomicBoolean(false);
     private DatabaseListener listener;
@@ -1288,11 +1288,11 @@
         return store.allocateStoreTracking();
     }
 
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerQueueStore.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerQueueStore.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerQueueStore.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/java/org/apache/activemq/apollo/broker/BrokerQueueStore.java Sun Dec  6 14:40:34 2009
@@ -24,7 +24,7 @@
 
 import org.apache.activemq.broker.store.Store.MessageRecord;
 import org.apache.activemq.broker.store.Store.QueueQueryResult;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.flow.ISourceController;
 import org.apache.activemq.flow.PrioritySizeLimiter;
 import org.apache.activemq.flow.SizeLimiter;
@@ -52,7 +52,7 @@
     private static final boolean USE_PRIORITY_QUEUES = true;
 
     private BrokerDatabase database;
-    private Dispatch dispatcher;
+    private Dispatcher dispatcher;
 
     private static HashMap<String, ProtocolHandler> protocolHandlers = new HashMap<String, ProtocolHandler>();
     private static final BrokerDatabase.MessageRecordMarshaller<MessageDelivery> MESSAGE_MARSHALLER = new BrokerDatabase.MessageRecordMarshaller<MessageDelivery>() {
@@ -226,7 +226,7 @@
         this.database = database;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/BrokerTestBase.java Sun Dec  6 14:40:34 2009
@@ -30,8 +30,8 @@
 import org.apache.activemq.apollo.broker.Router;
 import org.apache.activemq.broker.store.Store;
 import org.apache.activemq.broker.store.StoreFactory;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 import org.apache.activemq.metric.MetricAggregator;
 import org.apache.activemq.metric.Period;
 import org.apache.activemq.transport.TransportFactory;
@@ -87,7 +87,7 @@
     protected Broker sendBroker;
     protected Broker rcvBroker;
     protected ArrayList<Broker> brokers = new ArrayList<Broker>();
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
     protected final AtomicLong msgIdGenerator = new AtomicLong();
     protected final AtomicBoolean stopping = new AtomicBoolean();
 
@@ -134,8 +134,8 @@
 
     protected abstract String getRemoteWireFormat();
 
-    protected Dispatch createDispatcher() {
-        return DispatchFactory.create("test", asyncThreadPoolSize);
+    protected Dispatcher createDispatcher() {
+        return DispatcherFactory.create("test", asyncThreadPoolSize);
     }
 
     @Test

Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/SharedQueueTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/SharedQueueTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/SharedQueueTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/test/java/org/apache/activemq/broker/SharedQueueTest.java Sun Dec  6 14:40:34 2009
@@ -26,8 +26,8 @@
 import org.apache.activemq.apollo.broker.MessageDelivery;
 import org.apache.activemq.broker.store.Store;
 import org.apache.activemq.broker.store.StoreFactory;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 import org.apache.activemq.queue.IQueue;
 
 /**
@@ -37,7 +37,7 @@
 public class SharedQueueTest extends TestCase {
 
 
-    Dispatch dispatcher;
+    Dispatcher dispatcher;
     BrokerDatabase database;
     BrokerQueueStore queueStore;
     private static final boolean USE_KAHA_DB = true;
@@ -46,8 +46,8 @@
 
     protected ArrayList<IQueue<Long, MessageDelivery>> queues = new ArrayList<IQueue<Long, MessageDelivery>>();
 
-    protected Dispatch createDispatcher() {
-        return DispatchFactory.create("test", Runtime.getRuntime().availableProcessors());
+    protected Dispatcher createDispatcher() {
+        return DispatcherFactory.create("test", Runtime.getRuntime().availableProcessors());
     }
 
     protected int consumerStartDelay = 0;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchSystem.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchSystem.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchSystem.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchSystem.java Sun Dec  6 14:40:34 2009
@@ -18,7 +18,7 @@
 
 import java.nio.channels.SelectableChannel;
 
-import org.apache.activemq.dispatch.internal.simple.SimpleDispatchSPI;
+import org.apache.activemq.dispatch.internal.simple.SimpleDispatcher;
 
 /**
  * 
@@ -26,34 +26,34 @@
  */
 public class DispatchSystem {
 
-    final private static Dispatch spi = create();
+    final private static Dispatcher dispatcher = create();
 
-    private static Dispatch create() {
-        return new SimpleDispatchSPI("system", Runtime.getRuntime().availableProcessors());
+    private static Dispatcher create() {
+        return new SimpleDispatcher("system", Runtime.getRuntime().availableProcessors());
     }
 
     static DispatchQueue getMainQueue() {
-        return spi.getMainQueue();
+        return dispatcher.getMainQueue();
     }
     
     static public DispatchQueue getGlobalQueue() {
-        return spi.getGlobalQueue();
+        return dispatcher.getGlobalQueue();
     }
     
     static public DispatchQueue getGlobalQueue(DispatchPriority priority) {
-        return spi.getGlobalQueue(priority);
+        return dispatcher.getGlobalQueue(priority);
     }
     
     static DispatchQueue getSerialQueue(String label) {
-        return spi.createSerialQueue(label);
+        return dispatcher.createSerialQueue(label);
     }
     
     static void dispatchMain() {
-        spi.dispatchMain();
+        dispatcher.dispatchMain();
     }
 
     static DispatchSource createSource(SelectableChannel channel, int interestOps, DispatchQueue queue) {
-        return spi.createSource(channel, interestOps, queue);
+        return dispatcher.createSource(channel, interestOps, queue);
     }
 
 

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatcher.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatcher.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatcher.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/Dispatcher.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.dispatch;
+
+import java.nio.channels.SelectableChannel;
+
+
+public interface Dispatcher extends Retained {
+    
+    public void start();
+    public void shutdown(Runnable onShutdown);
+    
+    public DispatchQueue getGlobalQueue();
+    public DispatchQueue getGlobalQueue(DispatchPriority priority);
+    
+    public DispatchQueue createSerialQueue(String label);
+    
+    public DispatchQueue getMainQueue();
+    public void dispatchMain();
+    
+    public DispatchQueue getCurrentQueue();
+
+    public DispatchSource createSource(SelectableChannel channel, int interestOps, DispatchQueue queue);
+    
+}
\ No newline at end of file

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherAware.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherAware.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherAware.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherAware.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,14 @@
+package org.apache.activemq.dispatch;
+
+
+/**
+ * Handy interface to signal classes which would like an Dispatcher instance
+ * injected into them.
+ *  
+ * @author chirino
+ */
+public interface DispatcherAware {
+
+	public void setDispatcher(Dispatcher dispatcher);
+	
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherFactory.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherFactory.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherFactory.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.dispatch;
+
+import org.apache.activemq.dispatch.internal.simple.SimpleDispatcher;
+
+/**
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class DispatcherFactory {
+
+    public static Dispatcher create() {
+        return create("system", Runtime.getRuntime().availableProcessors());
+    }
+
+    public static Dispatcher create(String name, int threads) {
+        return new SimpleDispatcher(name, threads);
+    }
+    
+}

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherObserver.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherObserver.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherObserver.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatcherObserver.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.dispatch;
+
+import org.apache.activemq.dispatch.internal.simple.DispatcherThread;
+
+public interface DispatcherObserver {
+    
+    public void onThreadCreate(DispatcherThread thread);
+    public void onThreadDestroy(DispatcherThread thread);
+
+    public void onQueueCreate(DispatchQueue queue);
+    public void onQueueDestroy(DispatchQueue queue);
+    
+    public void onSourceCreate(DispatchSource source);
+    public void onSourceDestroy(DispatchSource source);
+    
+    public void onDispatchRequest(DispatchQueue target, Runnable request);
+
+}
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/SerialDispatchQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/SerialDispatchQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/SerialDispatchQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/SerialDispatchQueue.java Sun Dec  6 14:40:34 2009
@@ -22,12 +22,12 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.activemq.dispatch.DispatchQueue;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 
-import static org.apache.activemq.dispatch.DispatchFactory.*;
+import static org.apache.activemq.dispatch.DispatcherFactory.*;
 
-import static org.apache.activemq.dispatch.DispatchFactory.*;
+import static org.apache.activemq.dispatch.DispatcherFactory.*;
 
 /**
  * 

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatcher.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatcher.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatcher.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatcher.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.dispatch.internal.advanced;
+
+import java.nio.channels.SelectableChannel;
+import java.util.ArrayList;
+import java.util.concurrent.Executor;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatchPriority;
+import org.apache.activemq.dispatch.DispatchQueue;
+import org.apache.activemq.dispatch.DispatchSource;
+import org.apache.activemq.dispatch.internal.BaseRetained;
+import org.apache.activemq.dispatch.internal.SerialDispatchQueue;
+
+import static org.apache.activemq.dispatch.DispatchPriority.*;
+
+
+public class AdvancedDispatcher extends BaseRetained implements Dispatcher {
+
+    public final static ThreadLocal<DispatchQueue> CURRENT_QUEUE = new ThreadLocal<DispatchQueue>();
+
+    final SerialDispatchQueue mainQueue = new SerialDispatchQueue("main");
+    final GlobalDispatchQueue globalQueues[];
+    final AtomicLong globalQueuedRunnables = new AtomicLong();
+
+    private final ArrayList<DispatcherThread> dispatchers = new ArrayList<DispatcherThread>();
+
+    final AtomicInteger startCounter = new AtomicInteger();
+//    final AtomicBoolean started = new AtomicBoolean();
+//    final AtomicBoolean shutdown = new AtomicBoolean();
+
+    private int roundRobinCounter = 0;
+    private int size;
+    private final int numPriorities;
+
+    protected LoadBalancer loadBalancer;
+
+    public AdvancedDispatcher(int size, int numPriorities) {
+        this.size = size;
+        this.numPriorities = numPriorities;
+        
+        globalQueues = new GlobalDispatchQueue[3];
+        for (int i = 0; i < 3; i++) {
+            globalQueues[i] = new GlobalDispatchQueue(this, DispatchPriority.values()[i]);
+        }
+        
+        loadBalancer = new SimpleLoadBalancer();
+    }
+
+    /**
+     * Subclasses should implement this to return a new dispatcher.
+     * 
+     * @param name
+     *            The name to assign the dispatcher.
+     * @param pool
+     *            The pool.
+     * @return The new dispathcer.
+     */
+    protected DispatcherThread createDispatcher(String name) throws Exception {
+        return new DispatcherThread(this, name, numPriorities);
+    }
+
+    /**
+     * @see org.apache.activemq.dispatch.internal.advanced.DispatcherThread#start()
+     */
+    public synchronized final void start()  {
+        if( startCounter.getAndIncrement()==0 ) {
+            // Create all the workers.
+            try {
+                loadBalancer.start();
+                for (int i = 0; i < size; i++) {
+                    DispatcherThread dispatacher = createDispatcher("dispatcher -" + (i + 1));
+                    dispatchers.add(dispatacher);
+                    dispatacher.start();
+                }
+            } catch (Exception e) {
+                shutdown();
+            }
+        }
+    }
+
+    public final void shutdown() {
+        shutdown(null);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.activemq.dispatch.IDispatcher#shutdown()
+     */
+    public final void shutdown(Runnable onShutdown) {
+        if( startCounter.decrementAndGet()==0 ) {
+            final AtomicInteger shutdownCountDown = new AtomicInteger(dispatchers.size());
+            for (DispatcherThread d : new ArrayList<DispatcherThread>(dispatchers)) {
+                d.shutdown(shutdownCountDown, onShutdown);
+            }
+            loadBalancer.stop();
+        }
+    }
+
+    /**
+     * A Dispatcher must call this to indicate that is has started it's dispatch
+     * loop.
+     */
+    public void onDispatcherStarted(DispatcherThread d) {
+        DispatcherThread.CURRENT.set(d);
+        loadBalancer.onDispatcherStarted(d);
+    }
+
+    public LoadBalancer getLoadBalancer() {
+        return loadBalancer;
+    }
+
+    /**
+     * A Dispatcher must call this when exiting it's dispatch loop
+     */
+    public void onDispatcherStopped(DispatcherThread d) {
+        synchronized (dispatchers) {
+            if (dispatchers.remove(d)) {
+                size--;
+            }
+        }
+        loadBalancer.onDispatcherStopped(d);
+    }
+
+    protected DispatcherThread chooseDispatcher() {
+        DispatcherThread d = DispatcherThread.CURRENT.get();
+        if (d == null) {
+            synchronized (dispatchers) {
+                if(dispatchers.isEmpty())
+                {
+                    throw new RejectedExecutionException();
+                }
+                if (++roundRobinCounter >= size) {
+                    roundRobinCounter = 0;
+                }
+                return dispatchers.get(roundRobinCounter);
+            }
+        } else {
+            return d;
+        }
+    }
+
+//    public DispatchContext register(Runnable runnable, String name) {
+//        return chooseDispatcher().register(runnable, name);
+//    }
+
+	public int getSize() {
+		return size;
+	}
+	
+    public final Executor createPriorityExecutor(final int priority) {
+        return new Executor() {
+            public void execute(final Runnable runnable) {
+                chooseDispatcher().dispatch(runnable, priority);
+            }
+
+        };
+    }
+
+    public int getDispatchPriorities() {
+        // TODO Auto-generated method stub
+        return numPriorities;
+    }
+
+    public void execute(Runnable command) {
+        chooseDispatcher().dispatch(command, 0);
+    }
+    
+    public void execute(Runnable command, int priority) {
+        chooseDispatcher().dispatch(command, priority);
+    }
+
+    public void schedule(final Runnable runnable, long delay, TimeUnit timeUnit) {
+        chooseDispatcher().schedule(runnable, delay, timeUnit);
+    }
+
+    public void schedule(final Runnable runnable, int priority, long delay, TimeUnit timeUnit) {
+        chooseDispatcher().schedule(runnable, priority, delay, timeUnit);
+    }
+    
+    public DispatchQueue getMainQueue() {
+        return mainQueue;
+    }
+    
+    public DispatchQueue getGlobalQueue() {
+        return getGlobalQueue(DEFAULT);
+    }
+
+    public DispatchQueue getGlobalQueue(DispatchPriority priority) {
+        return globalQueues[priority.ordinal()];
+    }
+    
+    public DispatchQueue createSerialQueue(String label) {
+        AdvancedSerialDispatchQueue rc = new AdvancedSerialDispatchQueue(label);
+        rc.setTargetQueue(getGlobalQueue());
+        return rc;
+    }
+    
+    public void dispatchMain() {
+        mainQueue.run();
+    }
+
+    public DispatchSource createSource(SelectableChannel channel, int interestOps, DispatchQueue queue) {
+        return null;
+    }
+
+    public DispatchQueue getCurrentQueue() {
+        return CURRENT_QUEUE.get();
+    }    
+
+}

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatchContext.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatchContext.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatchContext.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatchContext.java Sun Dec  6 14:40:34 2009
@@ -38,8 +38,8 @@
         this.runnable = runnable;
         this.label = label;
         this.target = thread;
-        if (persistent && target.spi != null) {
-            this.tracker = target.spi.getLoadBalancer().createExecutionTracker((DispatchContext) this);
+        if (persistent && target.dispatcher != null) {
+            this.tracker = target.dispatcher.getLoadBalancer().createExecutionTracker((DispatchContext) this);
         } else {
             this.tracker = null;
         }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatcherThread.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatcherThread.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatcherThread.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/DispatcherThread.java Sun Dec  6 14:40:34 2009
@@ -30,7 +30,7 @@
 import org.apache.activemq.util.TimerHeap;
 import org.apache.activemq.util.list.LinkedNodeList;
 
-import static org.apache.activemq.dispatch.DispatchFactory.*;
+import static org.apache.activemq.dispatch.DispatcherFactory.*;
 
 public class DispatcherThread implements Runnable {
 
@@ -46,7 +46,7 @@
     protected final HashSet<DispatchContext> contexts = new HashSet<DispatchContext>();
 
     // Set if this dispatcher is part of a dispatch pool:
-    protected final AdvancedDispatchSPI spi;
+    protected final AdvancedDispatcher dispatcher;
 
     // The local dispatch queue:
     protected final PriorityLinkedList<DispatchContext> priorityQueue;
@@ -75,7 +75,7 @@
         }
     };
 
-    protected DispatcherThread(AdvancedDispatchSPI spi, String name, int priorities) {
+    protected DispatcherThread(AdvancedDispatcher dispatcher, String name, int priorities) {
         this.name = name;
         
         this.dispatchQueues = new ThreadDispatchQueue[3];
@@ -88,7 +88,7 @@
         for (int i = 0; i < 2; i++) {
             foreignQueue[i] = new LinkedNodeList<ForeignEvent>();
         }
-        this.spi = spi;
+        this.dispatcher = dispatcher;
     }
     
     @SuppressWarnings("unchecked")
@@ -176,7 +176,7 @@
 
     public void run() {
 
-        spi.onDispatcherStarted((DispatcherThread) this);
+        dispatcher.onDispatcherStarted((DispatcherThread) this);
         DispatchContext pdc;
         try {
             while (running) {
@@ -184,7 +184,7 @@
                 // If no local work available wait for foreign work:
                 while((pdc = priorityQueue.poll())!=null){
                     if( pdc.priority < dispatchQueues.length ) {
-                        AdvancedDispatchSPI.CURRENT_QUEUE.set(dispatchQueues[pdc.priority]);
+                        AdvancedDispatcher.CURRENT_QUEUE.set(dispatchQueues[pdc.priority]);
                     }
                     
                     if (pdc.tracker != null) {
@@ -235,7 +235,7 @@
         } catch (Throwable thrown) {
             thrown.printStackTrace();
         } finally {
-            spi.onDispatcherStopped((DispatcherThread) this);
+            dispatcher.onDispatcherStopped((DispatcherThread) this);
             cleanup();
         }
     }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/GlobalDispatchQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/GlobalDispatchQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/GlobalDispatchQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/GlobalDispatchQueue.java Sun Dec  6 14:40:34 2009
@@ -29,11 +29,11 @@
 public class GlobalDispatchQueue implements DispatchQueue {
 
     private final String label;
-    private final AdvancedDispatchSPI spi;
+    private final AdvancedDispatcher dispatcher;
     private final DispatchPriority priority;
     
-    public GlobalDispatchQueue(AdvancedDispatchSPI spi, DispatchPriority priority) {
-        this.spi = spi;
+    public GlobalDispatchQueue(AdvancedDispatcher dispatcher, DispatchPriority priority) {
+        this.dispatcher = dispatcher;
         this.priority = priority;
         this.label=priority.toString();
     }
@@ -47,11 +47,11 @@
     }
 
     public void dispatchAsync(Runnable runnable) {
-        spi.execute(runnable, priority.ordinal());
+        dispatcher.execute(runnable, priority.ordinal());
     }
 
     public void dispatchAfter(Runnable runnable, long delay, TimeUnit unit) {
-        spi.schedule(runnable, priority.ordinal(), delay, TimeUnit.MILLISECONDS);
+        dispatcher.schedule(runnable, priority.ordinal(), delay, TimeUnit.MILLISECONDS);
     }
 
     public void dispatchSync(final Runnable runnable) throws InterruptedException {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/DispatcherThread.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/DispatcherThread.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/DispatcherThread.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/DispatcherThread.java Sun Dec  6 14:40:34 2009
@@ -27,17 +27,17 @@
  */
 final public class DispatcherThread extends Thread {
     private static final int MAX_DISPATCH_BEFORE_CHECKING_FOR_HIGHER_PRIO = 10000;
-    private final SimpleDispatchSPI spi;
+    private final SimpleDispatcher dispatcher;
     final ThreadDispatchQueue[] threadQueues;
     final AtomicLong threadQueuedRunnables = new AtomicLong();
         
-    public DispatcherThread(SimpleDispatchSPI spi, int ordinal) {
-        this.spi = spi;
+    public DispatcherThread(SimpleDispatcher dispatcher, int ordinal) {
+        this.dispatcher = dispatcher;
         this.threadQueues = new ThreadDispatchQueue[3];
         for (int i = 0; i < 3; i++) {
             threadQueues[i] = new ThreadDispatchQueue(this, DispatchPriority.values()[i] );
         }
-        setName(spi.getLabel()+" dispatcher: "+(ordinal+1));
+        setName(dispatcher.getLabel()+" dispatcher: "+(ordinal+1));
         setDaemon(true);
     }
     
@@ -47,7 +47,7 @@
             outer: while( true ) {
                 int counter=0;
                 for (SimpleQueue queue : threadQueues) {
-                    SimpleDispatchSPI.CURRENT_QUEUE.set(queue);
+                    SimpleDispatcher.CURRENT_QUEUE.set(queue);
                     Runnable runnable;
                     while( (runnable = queue.poll())!=null ) {
                         dispatch(runnable);
@@ -60,8 +60,8 @@
                     continue;
                 }
                 
-                for (SimpleQueue queue : spi.globalQueues) {
-                    SimpleDispatchSPI.CURRENT_QUEUE.set(threadQueues[queue.getPriority().ordinal()]);
+                for (SimpleQueue queue : dispatcher.globalQueues) {
+                    SimpleDispatcher.CURRENT_QUEUE.set(threadQueues[queue.getPriority().ordinal()]);
                     
                     Runnable runnable;
                     while( (runnable = queue.poll())!=null ) {
@@ -80,7 +80,7 @@
                     continue;
                 }
             
-//        GlobalDispatchQueue[] globalQueues = spi.globalQueues;
+//        GlobalDispatchQueue[] globalQueues = dispatcher.globalQueues;
 //        while( true ) {
 //
 //            if( dispatch(threadQueues[0]) 
@@ -117,7 +117,7 @@
                 break;
             }        
             if( counter==0 ) {
-                SimpleDispatchSPI.CURRENT_QUEUE.set(queue);
+                SimpleDispatcher.CURRENT_QUEUE.set(queue);
             }
             dispatch(runnable);
             counter++;
@@ -139,10 +139,10 @@
     private boolean inWaitingList;
     
     private void waitForWakeup() throws InterruptedException {
-        while( threadQueuedRunnables.get()==0 && spi.globalQueuedRunnables.get()==0 ) {
+        while( threadQueuedRunnables.get()==0 && dispatcher.globalQueuedRunnables.get()==0 ) {
             synchronized(wakeupMutex) {
                 if( !inWaitingList ) {
-                    spi.addWaitingDispatcher(this);
+                    dispatcher.addWaitingDispatcher(this);
                     inWaitingList=true;
                 }
                 wakeupMutex.wait();

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/GlobalDispatchQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/GlobalDispatchQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/GlobalDispatchQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/GlobalDispatchQueue.java Sun Dec  6 14:40:34 2009
@@ -30,17 +30,17 @@
  */
 public class GlobalDispatchQueue implements SimpleQueue {
 
-    private final SimpleDispatchSPI spi;
+    private final SimpleDispatcher dispatcher;
     final String label;
     final ConcurrentLinkedQueue<Runnable> runnables = new ConcurrentLinkedQueue<Runnable>();
     final AtomicLong counter;
     private final DispatchPriority priority;
 
-    public GlobalDispatchQueue(SimpleDispatchSPI spi, DispatchPriority priority) {
-        this.spi = spi;
+    public GlobalDispatchQueue(SimpleDispatcher dispatcher, DispatchPriority priority) {
+        this.dispatcher = dispatcher;
         this.priority = priority;
         this.label=priority.toString();
-        this.counter = spi.globalQueuedRunnables;
+        this.counter = dispatcher.globalQueuedRunnables;
     }
 
     public String getLabel() {
@@ -54,11 +54,11 @@
     public void dispatchAsync(Runnable runnable) {
         this.counter.incrementAndGet();
         runnables.add(runnable);
-        spi.wakeup();
+        dispatcher.wakeup();
     }
 
     public void dispatchAfter(Runnable runnable, long delay, TimeUnit unit) {
-        spi.timerThread.addRelative(runnable, this, delay, unit);
+        dispatcher.timerThread.addRelative(runnable, this, delay, unit);
     }
 
     public void dispatchSync(final Runnable runnable) throws InterruptedException {

Added: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatcher.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatcher.java?rev=887687&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatcher.java (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/SimpleDispatcher.java Sun Dec  6 14:40:34 2009
@@ -0,0 +1,152 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.dispatch.internal.simple;
+
+import java.nio.channels.SelectableChannel;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.activemq.dispatch.DispatchQueue;
+import org.apache.activemq.dispatch.DispatchPriority;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatchSource;
+import org.apache.activemq.dispatch.internal.BaseRetained;
+import org.apache.activemq.dispatch.internal.SerialDispatchQueue;
+
+import static org.apache.activemq.dispatch.DispatchPriority.*;
+
+
+
+/**
+ * Implements a simple dispatch system.
+ * 
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class SimpleDispatcher extends BaseRetained implements Dispatcher {
+        
+    public final static ThreadLocal<DispatchQueue> CURRENT_QUEUE = new ThreadLocal<DispatchQueue>();
+
+    final SerialDispatchQueue mainQueue = new SerialDispatchQueue("main");
+    final GlobalDispatchQueue globalQueues[]; 
+    final DispatcherThread dispatchers[];
+    final AtomicLong globalQueuedRunnables = new AtomicLong();
+    
+    final ConcurrentLinkedQueue<DispatcherThread> waitingDispatchers = new ConcurrentLinkedQueue<DispatcherThread>();
+    final AtomicInteger waitingDispatcherCount = new AtomicInteger();
+    final AtomicInteger startCounter = new AtomicInteger();
+    private final String label;
+    TimerThread timerThread;
+    
+    public SimpleDispatcher(String label, int size) {
+        this.label = label;
+        globalQueues = new GlobalDispatchQueue[3];
+        for (int i = 0; i < 3; i++) {
+            globalQueues[i] = new GlobalDispatchQueue(this, DispatchPriority.values()[i] );
+        }
+        dispatchers = new DispatcherThread[size];
+    }
+
+    public DispatchQueue getMainQueue() {
+        return mainQueue;
+    }
+    
+    public DispatchQueue getGlobalQueue() {
+        return getGlobalQueue(DEFAULT);
+    }
+
+    public DispatchQueue getGlobalQueue(DispatchPriority priority) {
+        return globalQueues[priority.ordinal()];
+    }
+    
+    public DispatchQueue createSerialQueue(String label) {
+        SerialDispatchQueue rc = new SerialDispatchQueue(label) {
+            @Override
+            public void dispatchAfter(Runnable runnable, long delay, TimeUnit unit) {
+                timerThread.addRelative(runnable, this, delay, unit);
+            }
+        };
+        rc.setTargetQueue(getGlobalQueue());
+        return rc;
+    }
+    
+    public void dispatchMain() {
+        mainQueue.run();
+    }
+
+    public DispatchSource createSource(SelectableChannel channel, int interestOps, DispatchQueue queue) {
+        return null;
+    }
+
+    public void addWaitingDispatcher(DispatcherThread dispatcher) {
+        waitingDispatcherCount.incrementAndGet();
+        waitingDispatchers.add(dispatcher);
+    }
+    
+    public void wakeup() {
+        int value = waitingDispatcherCount.get();
+        if( value!=0 ) {
+            DispatcherThread dispatcher = waitingDispatchers.poll();
+            if( dispatcher!=null ) {
+                waitingDispatcherCount.decrementAndGet();
+                dispatcher.globalWakeup();
+            }
+        }
+    }
+
+    public void start() {
+        if( startCounter.getAndIncrement()==0 ) {
+            for (int i = 0; i < dispatchers.length; i++) {
+                dispatchers[i] = new DispatcherThread(this, i);
+                dispatchers[i].start();
+            }
+            timerThread = new TimerThread(this);
+            timerThread.start();
+        }
+    }
+
+    public void shutdown(final Runnable onShutdown) {
+        if( startCounter.decrementAndGet()==0 ) {
+            
+            final AtomicInteger shutdownCountDown = new AtomicInteger(dispatchers.length+1);
+            Runnable wrapper = new Runnable() {
+                public void run() {
+                    if( shutdownCountDown.decrementAndGet()==0 && onShutdown!=null) {
+                        onShutdown.run();
+                    }
+                    throw new DispatcherThread.Shutdown();
+                }
+            };
+
+            timerThread.shutdown(wrapper);
+            for (int i = 0; i < dispatchers.length; i++) {
+                ThreadDispatchQueue queue = dispatchers[i].threadQueues[LOW.ordinal()];
+                queue.runnables.add(wrapper);
+            }
+        }
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public DispatchQueue getCurrentQueue() {
+        return CURRENT_QUEUE.get();
+    }
+    
+}

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/TimerThread.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/TimerThread.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/TimerThread.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/simple/TimerThread.java Sun Dec  6 14:40:34 2009
@@ -25,8 +25,8 @@
     private final Object mutex = new Object();
     private ArrayList<TimerRequest> requests = new ArrayList<TimerRequest>();
     
-    public TimerThread(SimpleDispatchSPI spi) {
-        setName(spi.getLabel()+" timer");
+    public TimerThread(SimpleDispatcher dispatcher) {
+        setName(dispatcher.getLabel()+" timer");
         setDaemon(true);
     }
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/actor/ActorTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/actor/ActorTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/actor/ActorTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/actor/ActorTest.java Sun Dec  6 14:40:34 2009
@@ -13,8 +13,8 @@
 import junit.framework.TestCase;
 
 import org.apache.activemq.dispatch.DispatchQueue;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.internal.advanced.AdvancedDispatchSPI;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.internal.advanced.AdvancedDispatcher;
 
 
 /** 
@@ -45,7 +45,7 @@
     
     public void testActorInvocation() throws Exception
     {
-        Dispatch advancedSystem = new AdvancedDispatchSPI(Runtime.getRuntime().availableProcessors(), 3);
+        Dispatcher advancedSystem = new AdvancedDispatcher(Runtime.getRuntime().availableProcessors(), 3);
         advancedSystem.start();
         
         DispatchQueue queue = advancedSystem.createSerialQueue("test");

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/DispatchSystemTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/DispatchSystemTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/DispatchSystemTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/DispatchSystemTest.java Sun Dec  6 14:40:34 2009
@@ -19,8 +19,8 @@
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.activemq.dispatch.internal.RunnableCountDownLatch;
-import org.apache.activemq.dispatch.internal.advanced.AdvancedDispatchSPI;
-import org.apache.activemq.dispatch.internal.simple.SimpleDispatchSPI;
+import org.apache.activemq.dispatch.internal.advanced.AdvancedDispatcher;
+import org.apache.activemq.dispatch.internal.simple.SimpleDispatcher;
 
 import static org.apache.activemq.dispatch.DispatchPriority.*;
 
@@ -33,7 +33,7 @@
 public class DispatchSystemTest {
 
     public static void main(String[] args) throws Exception {
-        Dispatch advancedSystem = new AdvancedDispatchSPI(Runtime.getRuntime().availableProcessors(), 3);
+        Dispatcher advancedSystem = new AdvancedDispatcher(Runtime.getRuntime().availableProcessors(), 3);
         advancedSystem.start();
         benchmark("advanced global queue", advancedSystem, advancedSystem.getGlobalQueue(DEFAULT));
         benchmark("advanced private serial queue", advancedSystem, advancedSystem.createSerialQueue("test"));
@@ -42,7 +42,7 @@
         advancedSystem.shutdown(latch);
         latch.await();
 
-        Dispatch simpleSystem = new SimpleDispatchSPI("test", Runtime.getRuntime().availableProcessors());
+        Dispatcher simpleSystem = new SimpleDispatcher("test", Runtime.getRuntime().availableProcessors());
         simpleSystem.start();
         
         benchmark("simple global queue", simpleSystem, simpleSystem.getGlobalQueue(DEFAULT));
@@ -53,13 +53,13 @@
         latch.await();
     }
 
-    private static void benchmark(String name, Dispatch spi, DispatchQueue queue) throws InterruptedException {
+    private static void benchmark(String name, Dispatcher dispatcher, DispatchQueue queue) throws InterruptedException {
         // warm the JIT up..
-        benchmarkWork(spi, queue, 100000);
+        benchmarkWork(dispatcher, queue, 100000);
         
         int iterations = 1000*1000*20;
         long start = System.nanoTime();
-        benchmarkWork(spi, queue, iterations);
+        benchmarkWork(dispatcher, queue, iterations);
         long end = System.nanoTime();
         
         double durationMS = 1.0d*(end-start)/1000000d;
@@ -68,13 +68,13 @@
         System.out.println(format("name: %s, duration: %,.3f ms, rate: %,.2f executions/sec", name, durationMS, rate));
     }
 
-    private static void benchmarkWork(final Dispatch spi, final DispatchQueue queue, int iterations) throws InterruptedException {
+    private static void benchmarkWork(final Dispatcher dispatcher, final DispatchQueue queue, int iterations) throws InterruptedException {
         final CountDownLatch counter = new CountDownLatch(iterations);
         Runnable task = new Runnable(){
             public void run() {
                 counter.countDown();
                 if( counter.getCount()>0 ) {
-                    spi.getCurrentQueue().dispatchAsync(this);
+                    dispatcher.getCurrentQueue().dispatchAsync(this);
                 }
             }
         };

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/internal/advanced/DispatcherPoolTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/internal/advanced/DispatcherPoolTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/internal/advanced/DispatcherPoolTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/test/java/org/apache/activemq/dispatch/internal/advanced/DispatcherPoolTest.java Sun Dec  6 14:40:34 2009
@@ -30,7 +30,7 @@
 public class DispatcherPoolTest {
     
     public static void main(String[] args) throws Exception {
-        AdvancedDispatchSPI pooledDispatcher = new AdvancedDispatchSPI(Runtime.getRuntime().availableProcessors(), 3);
+        AdvancedDispatcher pooledDispatcher = new AdvancedDispatcher(Runtime.getRuntime().availableProcessors(), 3);
         pooledDispatcher.start();
         
         // warm the JIT up..
@@ -48,7 +48,7 @@
         System.out.println(format("duration: %,.3f ms, rate: %,.2f executions/sec", durationMS, rate));
     }
 
-    private static void benchmarkWork(final AdvancedDispatchSPI pooledDispatcher, int iterations) throws InterruptedException {
+    private static void benchmarkWork(final AdvancedDispatcher pooledDispatcher, int iterations) throws InterruptedException {
         final CountDownLatch counter = new CountDownLatch(iterations);
         for (int i = 0; i < 1000; i++) {
             Work dispatchable = new Work(counter, pooledDispatcher);
@@ -61,9 +61,9 @@
         private final CountDownLatch counter;
         private final DispatchQueue dispatchQueue;
 
-        private Work(CountDownLatch counter, AdvancedDispatchSPI spi) {
+        private Work(CountDownLatch counter, AdvancedDispatcher dispatcher) {
             this.counter = counter;
-            dispatchQueue = spi.createSerialQueue("test");
+            dispatchQueue = dispatcher.createSerialQueue("test");
         }
 
         public void run() {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/main/java/org/apache/activemq/apollo/jaxb/DispatcherXml.java Sun Dec  6 14:40:34 2009
@@ -22,8 +22,8 @@
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.activemq.apollo.broker.Broker;
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 
 @XmlRootElement(name="dispatcher")
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -36,11 +36,11 @@
 	@XmlAttribute(required=false)
 	int threads = Runtime.getRuntime().availableProcessors();
 	
-	public Dispatch createDispatcher(BrokerXml brokerXml) {
+	public Dispatcher createDispatcher(BrokerXml brokerXml) {
 		if( name == null ) {
 			name = "broker";
 		}
-		return DispatchFactory.create(name, threads);
+		return DispatcherFactory.create(name, threads);
 	}
 
 }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-jaxb/src/test/java/org/apache/activemq/apollo/jaxb/JAXBConfigTest.java Sun Dec  6 14:40:34 2009
@@ -26,7 +26,7 @@
 import org.apache.activemq.apollo.broker.Broker;
 import org.apache.activemq.apollo.broker.BrokerFactory;
 import org.apache.activemq.broker.store.memory.MemoryStore;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.Test;
@@ -44,7 +44,7 @@
 		LOG.info("Loading broker configuration from the classpath with URI: " + uri);
 		Broker broker = BrokerFactory.createBroker(uri);
 		
-		Dispatch p = (Dispatch)broker.getDispatcher();
+		Dispatcher p = (Dispatcher)broker.getDispatcher();
 //		assertEquals(4, p.getSize());
 //		assertEquals("test dispatcher", p.getName());
 		

Modified: activemq/sandbox/activemq-apollo-actor/activemq-openwire/src/test/java/org/apache/activemq/perf/broker/SharedQueuePerfTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-openwire/src/test/java/org/apache/activemq/perf/broker/SharedQueuePerfTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-openwire/src/test/java/org/apache/activemq/perf/broker/SharedQueuePerfTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-openwire/src/test/java/org/apache/activemq/perf/broker/SharedQueuePerfTest.java Sun Dec  6 14:40:34 2009
@@ -38,10 +38,10 @@
 import org.apache.activemq.command.ActiveMQTextMessage;
 import org.apache.activemq.command.MessageId;
 import org.apache.activemq.command.ProducerId;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.dispatch.DispatchPriority;
 import org.apache.activemq.dispatch.DispatchQueue;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.DispatcherFactory;
 import org.apache.activemq.flow.AbstractLimitedFlowResource;
 import org.apache.activemq.flow.Flow;
 import org.apache.activemq.flow.FlowController;
@@ -65,7 +65,7 @@
 
     private static int PERFORMANCE_SAMPLES = 5;
 
-    Dispatch dispatcher;
+    Dispatcher dispatcher;
     BrokerDatabase database;
     BrokerQueueStore queueStore;
     private static final boolean USE_KAHA_DB = true;
@@ -82,8 +82,8 @@
     protected ArrayList<Producer> producers = new ArrayList<Producer>();
     protected ArrayList<IQueue<Long, MessageDelivery>> queues = new ArrayList<IQueue<Long, MessageDelivery>>();
 
-    protected Dispatch createDispatcher() {
-        return DispatchFactory.create("pref-test", THREAD_POOL_SIZE);
+    protected Dispatcher createDispatcher() {
+        return DispatcherFactory.create("pref-test", THREAD_POOL_SIZE);
     }
 
     protected int consumerStartDelay = 0;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/AbstractFlowQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/AbstractFlowQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/AbstractFlowQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/AbstractFlowQueue.java Sun Dec  6 14:40:34 2009
@@ -21,7 +21,7 @@
 
 import org.apache.activemq.dispatch.DispatchQueue;
 import org.apache.activemq.dispatch.DispatchPriority;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.flow.ISinkController.FlowControllable;
 
 /**
@@ -32,7 +32,7 @@
  */
 public abstract class AbstractFlowQueue<E> extends AbstractFlowRelay<E> implements FlowControllable<E>, IFlowQueue<E> {
 
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
     protected Collection<IPollableFlowSource.FlowReadyListener<E>> readyListeners;
     private boolean notifyReady = false;
     protected int dispatchPriority = 0;
@@ -132,7 +132,7 @@
      * @param dispatcher
      *            The dispatcher to handle messages.
      */
-    public synchronized void setDispatcher(Dispatch dispatcher) {
+    public synchronized void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
         
         dispatchQueue = dispatcher.createSerialQueue(getResourceName());

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IFlowQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IFlowQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IFlowQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IFlowQueue.java Sun Dec  6 14:40:34 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.queue;
 
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.flow.IFlowRelay;
 
 public interface IFlowQueue<E> extends IBlockingFlowSource<E>, IPollableFlowSource<E>, IFlowRelay<E> {
@@ -57,7 +57,7 @@
      * @param dispatcher
      *            The dispatcher to be used by the queue.
      */
-    public void setDispatcher(Dispatch dispatcher);
+    public void setDispatcher(Dispatcher dispatcher);
 
     /**
      * Sets the base dispatch priority for the queue. Setting to higher value

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/IQueue.java Sun Dec  6 14:40:34 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.queue;
 
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.queue.QueueStore.PersistentQueue;
 import org.apache.activemq.util.Mapper;
 
@@ -47,7 +47,7 @@
      * @param dispatcher
      *            The dispatcher to be used by the queue.
      */
-    public void setDispatcher(Dispatch dispatcher);
+    public void setDispatcher(Dispatcher dispatcher);
 
     /**
      * Sets the base dispatch priority for the queue. Setting to higher value

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/PartitionedQueue.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/PartitionedQueue.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/PartitionedQueue.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/main/java/org/apache/activemq/queue/PartitionedQueue.java Sun Dec  6 14:40:34 2009
@@ -21,7 +21,7 @@
 import java.util.HashSet;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.flow.ISourceController;
 import org.apache.activemq.util.Mapper;
 import org.apache.activemq.util.buffer.AsciiBuffer;
@@ -31,7 +31,7 @@
     protected HashSet<Subscription<V>> subscriptions = new HashSet<Subscription<V>>();
     private HashMap<Integer, IQueue<K, V>> partitions = new HashMap<Integer, IQueue<K, V>>();
     protected QueueStore<K, V> store;
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
     protected boolean started;
     protected boolean shutdown = false;
     protected QueueDescriptor queueDescriptor;
@@ -253,7 +253,7 @@
         this.autoRelease = autoRelease;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         checkShutdown();
         this.dispatcher = dispatcher;
         synchronized (this) {

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/AbstractTestConnection.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/AbstractTestConnection.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/AbstractTestConnection.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/AbstractTestConnection.java Sun Dec  6 14:40:34 2009
@@ -11,7 +11,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.activemq.dispatch.DispatchPriority;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.flow.AbstractLimiter;
 import org.apache.activemq.flow.Flow;
 import org.apache.activemq.flow.IFlowLimiter;
@@ -66,12 +66,12 @@
     private final int inputWindowSize = 1000;
     private final int inputResumeThreshold = 500;
 
-    private Dispatch dispatcher;
+    private Dispatcher dispatcher;
     private final AtomicBoolean stopping = new AtomicBoolean(false);
     protected boolean blockingTransport = false;
     ExecutorService blockingWriter;
 
-    public static void setInShutdown(boolean val, Dispatch dispatcher) {
+    public static void setInShutdown(boolean val, Dispatcher dispatcher) {
         if (val != inShutdown.getAndSet(val)) {
             if (val) {
                 if (USE_RATE_BASED_LIMITER) {
@@ -275,11 +275,11 @@
         this.priorityLevels = priorityLevels;
     }
 
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 
@@ -456,12 +456,12 @@
 
     protected static class RateBasedLimiterCollector implements Runnable {
 
-        private Dispatch dispatcher;
+        private Dispatcher dispatcher;
         private int samplingPeriod = 50;
         private boolean scheduled = false;
         private HashSet<RateBasedLimiter> limiters = new HashSet<RateBasedLimiter>();
 
-        public synchronized void setDispatcher(Dispatch d) {
+        public synchronized void setDispatcher(Dispatcher d) {
             if (d != dispatcher) {
                 scheduled = false;
                 dispatcher = d;

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBroker.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBroker.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBroker.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBroker.java Sun Dec  6 14:40:34 2009
@@ -21,9 +21,9 @@
 import java.util.HashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
-import org.apache.activemq.dispatch.DispatchAware;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
+import org.apache.activemq.dispatch.DispatcherAware;
 import org.apache.activemq.flow.IFlowSink;
 import org.apache.activemq.flow.Commands.Destination;
 import org.apache.activemq.transport.Transport;
@@ -53,7 +53,7 @@
     private TransportServer transportServer;
     private String uri;
     private String name;
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
     private final AtomicBoolean stopping = new AtomicBoolean();
     private boolean useInputQueues = false;
 
@@ -125,8 +125,8 @@
 
         transportServer = TransportFactory.bind(new URI(uri));
         transportServer.setAcceptListener(this);
-        if (transportServer instanceof DispatchAware) {
-            ((DispatchAware) transportServer).setDispatcher(dispatcher);
+        if (transportServer instanceof DispatcherAware) {
+            ((DispatcherAware) transportServer).setDispatcher(dispatcher);
         }
         transportServer.start();
 
@@ -159,7 +159,7 @@
         error.printStackTrace();
     }
 
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
 
@@ -167,7 +167,7 @@
         this.name = name;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 
@@ -189,7 +189,7 @@
 
     protected void createDispatcher() {
         if (dispatcher == null) {
-            dispatcher = DispatchFactory.create("mock-broker", Runtime.getRuntime().availableProcessors());
+            dispatcher = DispatcherFactory.create("mock-broker", Runtime.getRuntime().availableProcessors());
         }
     }
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBrokerTest.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBrokerTest.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockBrokerTest.java Sun Dec  6 14:40:34 2009
@@ -20,8 +20,8 @@
 
 import junit.framework.TestCase;
 
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 import org.apache.activemq.flow.Commands.Destination;
 import org.apache.activemq.flow.Commands.Destination.DestinationBean;
 import org.apache.activemq.flow.Commands.Destination.DestinationBuffer;
@@ -63,7 +63,7 @@
     protected MockBroker rcvBroker;
     protected MockClient client;
 
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
 
     static public final Mapper<Long, Message> KEY_MAPPER = new Mapper<Long, Message>() {
         public Long map(Message element) {
@@ -94,8 +94,8 @@
         }
     }
 
-    protected Dispatch createDispatcher(String name) {
-        return DispatchFactory.create("test", threadsPerDispatcher);
+    protected Dispatcher createDispatcher(String name) {
+        return DispatcherFactory.create("test", threadsPerDispatcher);
     }
 
     public void test_1_1_0() throws Exception {
@@ -284,7 +284,7 @@
             }
         }
 
-        Dispatch clientDispatcher = null;
+        Dispatcher clientDispatcher = null;
         if (SEPARATE_CLIENT_DISPATCHER) {
             clientDispatcher = createDispatcher("ClientDispatcher");
             clientDispatcher.start();

Modified: activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockClient.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockClient.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockClient.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-queue/src/test/java/org/apache/activemq/queue/perf/MockClient.java Sun Dec  6 14:40:34 2009
@@ -7,8 +7,8 @@
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.activemq.dispatch.Dispatch;
-import org.apache.activemq.dispatch.DispatchFactory;
+import org.apache.activemq.dispatch.Dispatcher;
+import org.apache.activemq.dispatch.DispatcherFactory;
 import org.apache.activemq.flow.Commands.Destination;
 import org.apache.activemq.flow.Commands.Destination.DestinationBean;
 import org.apache.activemq.flow.Commands.Destination.DestinationBuffer;
@@ -43,7 +43,7 @@
     protected ArrayList<MetricCounter> additionalReportMetrics = new ArrayList<MetricCounter>();
     protected boolean includeDetailedRates = false;
 
-    protected Dispatch dispatcher;
+    protected Dispatcher dispatcher;
 
     public RemoteConsumer consumer(int index) {
         return consumers.get(index);
@@ -214,7 +214,7 @@
         return testName;
     }
 
-    public void setDispatcher(Dispatch dispatcher) {
+    public void setDispatcher(Dispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 
@@ -274,13 +274,13 @@
         }
     }
 
-    public Dispatch getDispatcher() {
+    public Dispatcher getDispatcher() {
         return dispatcher;
     }
 
-    protected Dispatch createDispatcher() {
+    protected Dispatcher createDispatcher() {
         if (dispatcher == null) {
-            dispatcher = DispatchFactory.create("client", threadsPerDispatcher);
+            dispatcher = DispatcherFactory.create("client", threadsPerDispatcher);
         }
         return dispatcher;
     }

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/DispatchableTransport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/DispatchableTransport.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/DispatchableTransport.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/DispatchableTransport.java Sun Dec  6 14:40:34 2009
@@ -17,9 +17,9 @@
 package org.apache.activemq.transport;
 
 import org.apache.activemq.dispatch.DispatchPriority;
-import org.apache.activemq.dispatch.DispatchAware;
+import org.apache.activemq.dispatch.DispatcherAware;
 
-public interface DispatchableTransport extends Transport, DispatchAware {
+public interface DispatchableTransport extends Transport, DispatcherAware {
 
     public void setDispatchPriority(DispatchPriority priority);
 

Modified: activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/pipe/PipeTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/pipe/PipeTransportFactory.java?rev=887687&r1=887686&r2=887687&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/pipe/PipeTransportFactory.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-transport/src/main/java/org/apache/activemq/transport/pipe/PipeTransportFactory.java Sun Dec  6 14:40:34 2009
@@ -14,9 +14,9 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.dispatch.DispatchPriority;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.dispatch.DispatchQueue;
-import org.apache.activemq.dispatch.Dispatch;
+import org.apache.activemq.dispatch.Dispatcher;
 import org.apache.activemq.dispatch.internal.RunnableCountDownLatch;
 import org.apache.activemq.transport.DispatchableTransport;
 import org.apache.activemq.transport.FutureResponse;
@@ -82,7 +82,7 @@
             }
         }
 
-        public void setDispatcher(Dispatch dispatcher) {
+        public void setDispatcher(Dispatcher dispatcher) {
             dispatchQueue = dispatcher.createSerialQueue(name);
             dispatchTask = new Runnable(){
                 public void run() {



Mime
View raw message