activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r423792 - /incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
Date Thu, 20 Jul 2006 06:03:46 GMT
Author: chirino
Date: Wed Jul 19 23:03:45 2006
New Revision: 423792

URL: http://svn.apache.org/viewvc?rev=423792&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQ-789

Modified:
    incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java

Modified: incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
URL: http://svn.apache.org/viewvc/incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java?rev=423792&r1=423791&r2=423792&view=diff
==============================================================================
--- incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
(original)
+++ incubator/activemq/branches/activemq-4.0/activemq-core/src/main/java/org/apache/activemq/transport/WireFormatNegotiator.java
Wed Jul 19 23:03:45 2006
@@ -26,6 +26,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
 
 
@@ -35,6 +36,7 @@
     
     private OpenWireFormat wireFormat;
     private final int minimumVersion;
+    private long negotiateTimeout=15000;
     
     private final AtomicBoolean firstStart=new AtomicBoolean(true);
     private final CountDownLatch readyCountDownLatch = new CountDownLatch(1);
@@ -75,7 +77,8 @@
     
     public void oneway(Command command) throws IOException {
         try {
-            readyCountDownLatch.await();
+            if( !readyCountDownLatch.await(negotiateTimeout, TimeUnit.MILLISECONDS) ) 
+            	throw new IOException("Wire format negociation timeout: peer did not send his
wire format.");
         } catch (InterruptedException e) {
             throw new InterruptedIOException();
         }
@@ -135,4 +138,13 @@
     
     protected void onWireFormatNegotiated(WireFormatInfo info) {
     }
+
+
+	public long getNegotiateTimeout() {
+		return negotiateTimeout;
+	}
+
+	public void setNegotiateTimeout(long negotiateTimeout) {
+		this.negotiateTimeout = negotiateTimeout;
+	}
 }



Mime
View raw message