Author: chirino
Date: Tue Mar 18 06:18:22 2008
New Revision: 638358
URL: http://svn.apache.org/viewvc?rev=638358&view=rev
Log:
Don't send the ShutdownInfo when stopping the transport. This should make it
faster to shutdown a failed connection.
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=638358&r1=638357&r2=638358&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Tue Mar 18 06:18:22 2008
@@ -925,11 +925,6 @@
if (duplexBridge != null) {
duplexBridge.stop();
}
- // If the transport has not failed yet,
- // notify the peer that we are doing a normal shutdown.
- if (transportException == null) {
- transport.oneway(new ShutdownInfo());
- }
}
} catch (Exception ignore) {
@@ -943,12 +938,6 @@
cs.getContext().getStopping().set(true);
}
- if (taskRunner != null) {
- taskRunner.wakeup();
- // Give it a change to stop gracefully.
- dispatchStoppedLatch.await(5, TimeUnit.SECONDS);
- }
-
try {
transport.stop();
LOG.debug("Stopped connection: " + transport.getRemoteAddress());
@@ -957,9 +946,12 @@
}
if (taskRunner != null) {
+ taskRunner.wakeup();
+ // Give it a change to stop gracefully.
+ dispatchStoppedLatch.await(5, TimeUnit.SECONDS);
taskRunner.shutdown();
}
-
+
active = false;
// Run the MessageDispatch callbacks so that message references get
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java?rev=638358&r1=638357&r2=638358&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
(original)
+++
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
Tue Mar 18 06:18:22 2008
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.activemq.Service;
import org.apache.activemq.command.Command;
@@ -40,6 +41,7 @@
private Transport transport;
private boolean shuttingDown;
private TransportListener listener;
+ public AtomicReference<Throwable> error = new AtomicReference<Throwable>();
public StubConnection(BrokerService broker) throws Exception {
this(TransportFactory.connect(broker.getVmConnectorURI()));
@@ -63,13 +65,11 @@
}
}
- public void onException(IOException error) {
+ public void onException(IOException e) {
if (listener != null) {
- listener.onException(error);
- }
- if (!shuttingDown) {
- error.printStackTrace();
+ listener.onException(e);
}
+ error.set(e);
}
});
transport.start();