From e9ce4ce40beed4bf974f8542ee86222c4e06ade5 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 5 Feb 2016 16:42:34 -0500 Subject: [PATCH] ARTEMIS-392 Fixing Allocator after socket upgrade https://issues.apache.org/jira/browse/ARTEMIS-392 --- .../activemq/artemis/core/protocol/ProtocolHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java index 08fc044d56..8f965ce5b8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java @@ -43,6 +43,7 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.HttpKeepAliveRunnabl import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection; +import org.apache.activemq.artemis.core.remoting.impl.netty.PartialPooledByteBufAllocator; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.server.protocol.stomp.WebSocketServerHandler; import org.apache.activemq.artemis.spi.core.protocol.ProtocolManager; @@ -172,6 +173,11 @@ public class ProtocolHandler { NettyServerConnection connection = channelHandler.createConnection(ctx, protocolToUse, httpEnabled); protocolManagerToUse.handshake(connection, new ChannelBufferWrapper(in)); pipeline.remove(this); + + // https://issues.apache.org/jira/browse/ARTEMIS-392 + // Application servers or other components may upgrade a regular socket to Netty + // We need to be able to work normally as with anything else on Artemis + ctx.channel().config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); ctx.flush(); }