protected void bind(int port, ConnectorConfiguration connectorConfig)
{
try
{
IoAcceptor acceptor = new SocketAcceptor();
SocketAcceptorConfig sconfig = (SocketAcceptorConfig) acceptor.getDefaultConfig();
SocketSessionConfig sc = (SocketSessionConfig) sconfig.getSessionConfig();
sc.setReceiveBufferSize(connectorConfig.socketReceiveBufferSize);
sc.setSendBufferSize(connectorConfig.socketWriteBuferSize);
sc.setTcpNoDelay(true);
// if we do not use the executor pool threading model we get the default leader follower
// implementation provided by MINA
if (connectorConfig.enableExecutorPool)
{
sconfig.setThreadModel(new ReadWriteThreadModel());
}
String host = InetAddress.getLocalHost().getHostName();
ClusteredProtocolHandler handler = new ClusteredProtocolHandler(new InetSocketAddress(host, port));
if (connectorConfig.enableNonSSL)
{
acceptor.bind(new InetSocketAddress(port), handler, sconfig);
_logger.info("Qpid.AMQP listening on non-SSL port " + port);
handler.connect(commandLine.getOptionValue("j"));
}
if (connectorConfig.enableSSL)
{
ClusteredProtocolHandler sslHandler = new ClusteredProtocolHandler(handler);
sslHandler.setUseSSL(true);
acceptor.bind(new InetSocketAddress(connectorConfig.sslPort), handler, sconfig);
_logger.info("Qpid.AMQP listening on SSL port " + connectorConfig.sslPort);
}
}
catch (IOException e)
{