activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r381328 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker: AbstractConnection.java TransportConnection.java
Date Mon, 27 Feb 2006 12:39:13 GMT
Author: rajdavies
Date: Mon Feb 27 04:39:06 2006
New Revision: 381328

URL: http://svn.apache.org/viewcvs?rev=381328&view=rev
Log:
Enure reference count for MessageReference is always updated - if dispatched sync or async

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java?rev=381328&r1=381327&r2=381328&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/AbstractConnection.java
Mon Feb 27 04:39:06 2006
@@ -136,7 +136,7 @@
     }
     
     public void start() throws Exception {
-        this.dispatch(connector.getBrokerInfo());
+        this.processDispatch(connector.getBrokerInfo());
     }
 
     public void stop() throws Exception {
@@ -537,32 +537,11 @@
         return connector;
     }
 
-    public void dispatchSync(Command command) {
-        
-        if( command.isMessageDispatch() ) {
-            
-            MessageDispatch md = (MessageDispatch) command;
-            Runnable sub = (Runnable) md.getConsumer();
-            broker.processDispatch(md);
-            
-            try {
-                dispatch( command );
-            } finally {
-                if( sub != null ) {
-                    sub.run();
-                }
-            }
-            
-        } else {
-            dispatch( command );
-        }
+    public void dispatchSync(Command message) {
+        processDispatch(message);
     }
     
     public void dispatchAsync(Command message) {
-        if (message.isMessageDispatch()){
-            MessageDispatch md = (MessageDispatch) message;
-            broker.processDispatch(md);
-        }
         if( taskRunner==null ) {
             dispatchSync( message );
         } else {
@@ -575,12 +554,29 @@
         }        
     }
     
+    protected void processDispatch(Command command){
+        if(command.isMessageDispatch()){
+            MessageDispatch md=(MessageDispatch) command;
+            Runnable sub=(Runnable) md.getConsumer();
+            broker.processDispatch(md);
+            try{
+                dispatch(command);
+            }finally{
+                if(sub!=null){
+                    sub.run();
+                }
+            }
+        }else{
+            dispatch(command);
+        }
+    }       
+    
     public boolean iterate() {
         if( dispatchQueue.isEmpty() ) {
             return false;
         } else {
             Command command = (Command) dispatchQueue.remove(0);
-            dispatch( command );
+            processDispatch( command );
             return true;
         }
     }    

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=381328&r1=381327&r2=381328&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Mon Feb 27 04:39:06 2006
@@ -21,6 +21,7 @@
 import org.apache.activemq.broker.ft.MasterBroker;
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.command.Command;
+import org.apache.activemq.command.MessageDispatch;
 import org.apache.activemq.command.Response;
 import org.apache.activemq.command.ShutdownInfo;
 import org.apache.activemq.thread.TaskRunnerFactory;
@@ -192,20 +193,17 @@
         this.active=active;
     }
     
-    public Response processBrokerInfo(BrokerInfo info) {
-        if (info.isSlaveBroker()){
+    public Response processBrokerInfo(BrokerInfo info){
+        if(info.isSlaveBroker()){
             //stream messages from this broker (the master) to 
             //the slave
-            MutableBrokerFilter parent = (MutableBrokerFilter)broker.getAdaptor(MutableBrokerFilter.class);
-            masterBroker = new MasterBroker(parent,transport);  
+            MutableBrokerFilter parent=(MutableBrokerFilter) broker.getAdaptor(MutableBrokerFilter.class);
+            masterBroker=new MasterBroker(parent,transport);
             masterBroker.startProcessing();
-            log.info("Slave Broker " + info.getBrokerName() + " is attached");
+            log.info("Slave Broker "+info.getBrokerName()+" is attached");
         }
-        
         return super.processBrokerInfo(info);
     }
-    
-    
 
     protected void dispatch(Command command){
         try{
@@ -217,6 +215,5 @@
         }finally{
             setMarkedCandidate(false);
         }
-    }        
-
+    }
 }



Mime
View raw message