From 90726a60afffa0bff6db74b15340152ebe1d5082 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Mon, 8 Feb 2016 16:11:55 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-6153 Only setting the socketBufferSize in TcpTransport if the value is greater than 0 as other values are illegal. --- .../org/apache/activemq/transport/tcp/TcpTransport.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java index 335cde75fe..60fe2837de 100755 --- a/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java +++ b/activemq-client/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java @@ -453,8 +453,13 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S } try { - sock.setReceiveBufferSize(socketBufferSize); - sock.setSendBufferSize(socketBufferSize); + //only positive values are legal + if (socketBufferSize > 0) { + sock.setReceiveBufferSize(socketBufferSize); + sock.setSendBufferSize(socketBufferSize); + } else { + LOG.warn("Socket buffer size was set to {}; Skipping this setting as the size must be a positive number.", socketBufferSize); + } } catch (SocketException se) { LOG.warn("Cannot set socket buffer size = " + socketBufferSize); LOG.debug("Cannot set socket buffer size. Reason: " + se.getMessage() + ". This exception is ignored.", se);