You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/03/06 13:13:00 UTC
svn commit: r383523 - in
/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport:
TransportThreadSupport.java tcp/TcpTransport.java
Author: jstrachan
Date: Mon Mar 6 04:12:53 2006
New Revision: 383523
URL: http://svn.apache.org/viewcvs?rev=383523&view=rev
Log:
added extra test to ensure that the transport instance is fully started before attempts are made to use the transport
Modified:
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java?rev=383523&r1=383522&r2=383523&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java Mon Mar 6 04:12:53 2006
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.transport;
+import org.apache.activemq.command.Command;
+import org.apache.activemq.command.ShutdownInfo;
import org.apache.activemq.util.ServiceStopper;
import java.io.IOException;
@@ -81,9 +83,12 @@
protected abstract void doStop(ServiceStopper stopper) throws Exception;
- protected void checkStarted() {
+ protected void checkStarted(Command command) {
if (!isStarted()) {
- throw new IllegalStateException("The transport " + this + " of type: " + getClass().getName() + " has not been started yet!");
+ // we might try to shut down the transport before it was ever started in some test cases
+ if (!(command instanceof ShutdownInfo)) {
+ throw new IllegalStateException("The transport " + this + " of type: " + getClass().getName() + " has not been started yet!");
+ }
}
}
}
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=383523&r1=383522&r2=383523&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java Mon Mar 6 04:12:53 2006
@@ -112,6 +112,7 @@
* A one way asynchronous send
*/
public void oneway(Command command) throws IOException {
+ checkStarted(command);
wireFormat.marshal(command, dataOut);
dataOut.flush();
}