diff --git a/activemq-broker/src/main/java/org/apache/activemq/transport/nio/AutoInitNioSSLTransport.java b/activemq-broker/src/main/java/org/apache/activemq/transport/nio/AutoInitNioSSLTransport.java index 9301b65644..c0d9df2e10 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/transport/nio/AutoInitNioSSLTransport.java +++ b/activemq-broker/src/main/java/org/apache/activemq/transport/nio/AutoInitNioSSLTransport.java @@ -158,8 +158,9 @@ public class AutoInitNioSSLTransport extends NIOSSLTransport { return readSize; } + //Prevent concurrent access to SSLEngine @Override - public void serviceRead() { + public synchronized void serviceRead() { try { if (handshakeInProgress) { doHandshake(); diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java index 9f5e65d9a2..3bcb0e4ec5 100644 --- a/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java @@ -243,8 +243,9 @@ public class NIOSSLTransport extends NIOTransport { } } + //Prevent concurrent access to SSLEngine @Override - public void serviceRead() { + public synchronized void serviceRead() { try { if (handshakeInProgress) { doHandshake();