activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r887334 - in /activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch: ./ internal/advanced/
Date Fri, 04 Dec 2009 19:51:29 GMT
Author: chirino
Date: Fri Dec  4 19:51:29 2009
New Revision: 887334

URL: http://svn.apache.org/viewvc?rev=887334&view=rev
Log:
merged PooledDispatchContext into DispatchContext

Removed:
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/PooledDispatchContext.java
Modified:
    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/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/LoadBalancer.java
    activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/SimpleLoadBalancer.java

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchObserver.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchObserver.java?rev=887334&r1=887333&r2=887334&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchObserver.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/DispatchObserver.java
Fri Dec  4 19:51:29 2009
@@ -19,7 +19,6 @@
 
 import org.apache.activemq.dispatch.internal.advanced.DispatchContext;
 import org.apache.activemq.dispatch.internal.advanced.Dispatcher;
-import org.apache.activemq.dispatch.internal.advanced.PooledDispatchContext;
 
 public interface DispatchObserver {
     
@@ -29,7 +28,7 @@
      * @param caller The calling dispatcher
      * @param context The context from which the dispatch is requested.
      */
-    public void onDispatch(Dispatcher caller, PooledDispatchContext context);
+    public void onDispatch(Dispatcher caller, DispatchContext context);
 
     /**
      * Must be called by the dispatcher when a {@link DispatchContext} is closed.

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatchSPI.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatchSPI.java?rev=887334&r1=887333&r2=887334&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatchSPI.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/AdvancedDispatchSPI.java
Fri Dec  4 19:51:29 2009
@@ -39,7 +39,7 @@
     final AtomicLong globalQueuedRunnables = new AtomicLong();
 
     private final ThreadLocal<DispatcherThread> dispatcher = new ThreadLocal<DispatcherThread>();
-    private final ThreadLocal<PooledDispatchContext> dispatcherContext = new ThreadLocal<PooledDispatchContext>();
+    private final ThreadLocal<DispatchContext> dispatcherContext = new ThreadLocal<DispatchContext>();
     private final ArrayList<DispatcherThread> dispatchers = new ArrayList<DispatcherThread>();
 
     final AtomicInteger startCounter = new AtomicInteger();
@@ -115,11 +115,11 @@
         }
     }
 
-    public void setCurrentDispatchContext(PooledDispatchContext context) {
+    public void setCurrentDispatchContext(DispatchContext context) {
         dispatcherContext.set(context);
     }
 
-    public PooledDispatchContext getCurrentDispatchContext() {
+    public DispatchContext getCurrentDispatchContext() {
         return dispatcherContext.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=887334&r1=887333&r2=887334&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
Fri Dec  4 19:51:29 2009
@@ -2,6 +2,8 @@
 
 import java.util.concurrent.RejectedExecutionException;
 
+import org.apache.activemq.dispatch.DispatchObserver;
+
 
 /**
  * Returned to callers registered with this dispathcer. Used by the caller
@@ -11,6 +13,7 @@
  * threads.
  */
 public interface DispatchContext {
+    
     /**
      * Once registered with a dispatcher, this can be called to request
      * dispatch. The {@link Dispatchable} will remain in the dispatch queue
@@ -41,4 +44,25 @@
      * no longer be used. 
      */
     public void close(boolean sync);
+    
+    /**
+     * Called to transfer a {@link PooledDispatchContext} to a new
+     * Dispatcher.
+     */
+    public void setTargetQueue(Dispatcher newDispatcher);
+
+    /**
+     * Gets the dispatcher to which this PooledDispatchContext currently
+     * belongs
+     * 
+     * @return
+     */
+    public Dispatcher getTargetQueue();
+
+    /**
+     * Gets the execution tracker for the context.
+     * 
+     * @return the execution tracker for the context:
+     */
+    public DispatchObserver getExecutionTracker();    
 }
\ No newline at end of file

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=887334&r1=887333&r2=887334&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
Fri Dec  4 19:51:29 2009
@@ -436,14 +436,14 @@
 
     }
 
-    private final PooledDispatchContext getCurrentDispatchContext() {
+    private final DispatchContext getCurrentDispatchContext() {
         return spi.getCurrentDispatchContext();
     }
 
     /**
      * 
      */
-    protected class PriorityDispatchContext extends LinkedNode<PriorityDispatchContext>
implements PooledDispatchContext {
+    protected class PriorityDispatchContext extends LinkedNode<PriorityDispatchContext>
implements DispatchContext {
         // The target:
         private final Runnable runnable;
         // The name of this context:
@@ -470,7 +470,7 @@
             this.name = name;
             this.currentOwner = (DispatcherThread) DispatcherThread.this;
             if (persistent && spi != null) {
-                this.tracker = spi.getLoadBalancer().createExecutionTracker((PooledDispatchContext)
this);
+                this.tracker = spi.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/LoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/LoadBalancer.java?rev=887334&r1=887333&r2=887334&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/LoadBalancer.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/LoadBalancer.java
Fri Dec  4 19:51:29 2009
@@ -39,7 +39,7 @@
      * @param context
      * @return
      */
-    public DispatchObserver createExecutionTracker(PooledDispatchContext context);
+    public DispatchObserver createExecutionTracker(DispatchContext context);
 
     /**
      * Starts execution tracking

Modified: activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/SimpleLoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/SimpleLoadBalancer.java?rev=887334&r1=887333&r2=887334&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/SimpleLoadBalancer.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dispatcher/src/main/java/org/apache/activemq/dispatch/internal/advanced/SimpleLoadBalancer.java
Fri Dec  4 19:51:29 2009
@@ -99,16 +99,16 @@
         dispatchers.remove(dispatcher);
     }
 
-    public DispatchObserver createExecutionTracker(PooledDispatchContext context) {
+    public DispatchObserver createExecutionTracker(DispatchContext context) {
         return new SimpleExecutionTracker(context);
     }
 
     private static class ExecutionStats {
-        final PooledDispatchContext target;
-        final PooledDispatchContext source;
+        final DispatchContext target;
+        final DispatchContext source;
         int count;
 
-        ExecutionStats(PooledDispatchContext source, PooledDispatchContext target) {
+        ExecutionStats(DispatchContext source, DispatchContext target) {
             this.target = target;
             this.source = source;
         }
@@ -119,14 +119,14 @@
     }
 
     private class SimpleExecutionTracker implements DispatchObserver {
-        private final HashMap<PooledDispatchContext, ExecutionStats> sources = new
HashMap<PooledDispatchContext, ExecutionStats>();
-        private final PooledDispatchContext context;
+        private final HashMap<DispatchContext, ExecutionStats> sources = new HashMap<DispatchContext,
ExecutionStats>();
+        private final DispatchContext context;
         private final AtomicInteger work = new AtomicInteger(0);
 
-        private PooledDispatchContext singleSource;
+        private DispatchContext singleSource;
         private Dispatcher currentOwner;
 
-        SimpleExecutionTracker(PooledDispatchContext context) {
+        SimpleExecutionTracker(DispatchContext context) {
             this.context = context;
             currentOwner = context.getTargetQueue();
         }
@@ -145,7 +145,7 @@
          * @return True if this method resulted in the dispatch request being
          *         assigned to another dispatcher.
          */
-        public void onDispatch(Dispatcher callingDispatcher, PooledDispatchContext callingContext)
{
+        public void onDispatch(Dispatcher callingDispatcher, DispatchContext callingContext)
{
 
             if (callingContext != null) {
                 // Make sure we are being called by another node:



Mime
View raw message