mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-5368 - improve nio ssl handshake performance - use soTimeout for handshake selector
This commit is contained in:
parent
18300c6514
commit
ad8879d283
|
@ -348,7 +348,6 @@ public class NIOSSLTransport extends NIOTransport {
|
||||||
Selector selector = null;
|
Selector selector = null;
|
||||||
SelectionKey key = null;
|
SelectionKey key = null;
|
||||||
boolean readable = true;
|
boolean readable = true;
|
||||||
int timeout = 100;
|
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus();
|
HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus();
|
||||||
|
@ -365,8 +364,8 @@ public class NIOSSLTransport extends NIOTransport {
|
||||||
} else {
|
} else {
|
||||||
key.interestOps(SelectionKey.OP_READ);
|
key.interestOps(SelectionKey.OP_READ);
|
||||||
}
|
}
|
||||||
int keyCount = selector.select(timeout);
|
int keyCount = selector.select(this.getSoTimeout());
|
||||||
if (keyCount == 0 && ((System.currentTimeMillis() - now) >= timeout)) {
|
if (keyCount == 0 && this.getSoTimeout() > 0 && ((System.currentTimeMillis() - now) >= this.getSoTimeout())) {
|
||||||
throw new SocketTimeoutException("Timeout during handshake");
|
throw new SocketTimeoutException("Timeout during handshake");
|
||||||
}
|
}
|
||||||
readable = key.isReadable();
|
readable = key.isReadable();
|
||||||
|
|
Loading…
Reference in New Issue