ARTEMIS-392 Fixing Allocator after socket upgrade

https://issues.apache.org/jira/browse/ARTEMIS-392
This commit is contained in:
Clebert Suconic 2016-02-05 16:42:34 -05:00 committed by jbertram
parent 8d275de12d
commit e9ce4ce40b
1 changed files with 6 additions and 0 deletions

View File

@ -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();
}