You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2009/05/05 00:21:06 UTC
svn commit: r771470 -
/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java
Author: rajith
Date: Mon May 4 22:21:06 2009
New Revision: 771470
URL: http://svn.apache.org/viewvc?rev=771470&view=rev
Log:
This is related to QPID-1839
I added a timeout (that could be configured via qpid.ssl_timeout if needed) to notify the application,
1) if the broker fails to respond in a timely manner
2) if there was an error and the broker has already closed the connection.
Modified:
qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java
Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java?rev=771470&r1=771469&r2=771470&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/ssl/SSLSender.java Mon May 4 22:21:06 2009
@@ -38,6 +38,7 @@
private SSLEngine engine;
private int sslBufSize;
private ByteBuffer netData;
+ private long timeout = 30000;
private final Object engineState = new Object();
private final AtomicBoolean closed = new AtomicBoolean(false);
@@ -49,7 +50,8 @@
this.engine = engine;
this.delegate = delegate;
sslBufSize = engine.getSession().getPacketBufferSize();
- netData = ByteBuffer.allocate(sslBufSize);
+ netData = ByteBuffer.allocate(sslBufSize);
+ timeout = Long.getLong("qpid.ssl_timeout", 60000);
}
public void close()
@@ -198,14 +200,22 @@
flush();
synchronized(engineState)
{
+ long start = System.currentTimeMillis();
try
{
- engineState.wait();
+ engineState.wait(timeout);
}
catch(InterruptedException e)
{
// pass
}
+
+ if (System.currentTimeMillis()- start >= timeout)
+ {
+ throw new SenderException(
+ "SSL Engine timed out waiting for a response." +
+ "To get more info,run with -Djavax.net.debug=ssl");
+ }
}
break;
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org