Merge pull request #488 from jbonofre/AMQ-7301

[AMQ-7301] Display warn in case of STOMP stream initialize error
This commit is contained in:
Jean-Baptiste Onofré 2020-03-02 09:23:42 +01:00 committed by GitHub
commit 0d0131496a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -29,9 +29,13 @@ import javax.net.ssl.SSLEngine;
import org.apache.activemq.transport.nio.NIOSSLTransport;
import org.apache.activemq.wireformat.WireFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class StompNIOSSLTransport extends NIOSSLTransport {
private final static Logger LOGGER = LoggerFactory.getLogger(StompNIOSSLTransport.class);
StompCodec codec;
private X509Certificate[] cachedPeerCerts;
@ -52,11 +56,15 @@ public class StompNIOSSLTransport extends NIOSSLTransport {
}
@Override
protected void initializeStreams() throws IOException {
codec = new StompCodec(this);
super.initializeStreams();
if (inputBuffer.position() != 0 && inputBuffer.hasRemaining()) {
serviceRead();
protected void initializeStreams() {
try {
codec = new StompCodec(this);
super.initializeStreams();
if (inputBuffer.position() != 0 && inputBuffer.hasRemaining()) {
serviceRead();
}
} catch (IOException e) {
LOGGER.warn("Could not initialize connection from {}", socket.getInetAddress().getHostAddress(), e);
}
}