activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r637965 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Date Mon, 17 Mar 2008 16:42:20 GMT
Author: chirino
Date: Mon Mar 17 09:42:09 2008
New Revision: 637965

URL: http://svn.apache.org/viewvc?rev=637965&view=rev
Log:
Just making it a little more thread safe.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=637965&r1=637964&r2=637965&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Mon Mar 17 09:42:09 2008
@@ -34,6 +34,7 @@
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.command.Command;
 import org.apache.activemq.command.ConnectionControl;
+import org.apache.activemq.command.Message;
 import org.apache.activemq.command.RemoveInfo;
 import org.apache.activemq.command.Response;
 import org.apache.activemq.state.ConnectionStateTracker;
@@ -385,6 +386,7 @@
 	 
 
     public void oneway(Object o) throws IOException {
+        
         Command command = (Command)o;
         Exception error = null;
         try {
@@ -409,7 +411,8 @@
                     try {
 
                         // Wait for transport to be connected.
-                        while (connectedTransport.get() == null && !disposed &&
connectionFailure == null) {
+                        Transport transport = connectedTransport.get();
+                        while (transport == null && !disposed && connectionFailure
== null) {
                             LOG.trace("Waiting for transport to reconnect.");
                             try {
                                 reconnectMutex.wait(1000);
@@ -417,9 +420,10 @@
                                 Thread.currentThread().interrupt();
                                 LOG.debug("Interupted: " + e, e);
                             }
+                            transport = connectedTransport.get();
                         }
 
-                        if (connectedTransport.get() == null) {
+                        if (transport == null) {
                             // Previous loop may have exited due to use being
                             // disposed.
                             if (disposed) {
@@ -445,7 +449,7 @@
 
                         // Send the message.
                         try {
-                            connectedTransport.get().oneway(command);
+                            transport.oneway(command);
                             stateTracker.trackBack(command);
                         } catch (IOException e) {
 



Mime
View raw message