ARTEMIS-416 - Netty Acceptor allows transfer of connections when paused

Throw an exception if the acceptor is paused or not started

https://issues.apache.org/jira/browse/ARTEMIS-416
This commit is contained in:
Andy Taylor 2016-02-22 14:26:59 +00:00 committed by Clebert Suconic
parent 8c6f45b919
commit f6ea511b8a
2 changed files with 6 additions and 0 deletions

View File

@ -426,6 +426,9 @@ public class NettyAcceptor extends AbstractAcceptor {
* @param channel A Netty channel created outside this NettyAcceptor. * @param channel A Netty channel created outside this NettyAcceptor.
*/ */
public void transfer(Channel channel) { public void transfer(Channel channel) {
if (paused || eventLoopGroup == null) {
throw ActiveMQMessageBundle.BUNDLE.acceptorUnavailable();
}
channel.pipeline().addLast(protocolHandler.getProtocolDecoder()); channel.pipeline().addLast(protocolHandler.getProtocolDecoder());
} }

View File

@ -365,4 +365,7 @@ public interface ActiveMQMessageBundle {
@Message(id = 119115, value = "Colocated Policy hasn't different type live and backup", format = Message.Format.MESSAGE_FORMAT) @Message(id = 119115, value = "Colocated Policy hasn't different type live and backup", format = Message.Format.MESSAGE_FORMAT)
ActiveMQIllegalStateException liveBackupMismatch(); ActiveMQIllegalStateException liveBackupMismatch();
@Message(id = 119116, value = "Netty Acceptor unavailable", format = Message.Format.MESSAGE_FORMAT)
IllegalStateException acceptorUnavailable();
} }