case SOCKET:
return new SocketTransportConnection(new SocketTransportConnection.SocketConnectorFactory()
{
public IoConnector newSocketConnector()
{
ExistingSocketConnector connector = new ExistingSocketConnector(1,new QpidThreadExecutor());
Socket socket = TransportConnection.removeOpenSocket(details.getHost());
if (socket != null)
{
_logger.info("Using existing Socket:" + socket);
((ExistingSocketConnector) connector).setOpenSocket(socket);
}
else
{
throw new IllegalArgumentException("Active Socket must be provided for broker " +
"with 'socket://<SocketID>' transport:" + details);
}
return connector;
}
});
case TCP:
return new SocketTransportConnection(new SocketTransportConnection.SocketConnectorFactory()
{
public IoConnector newSocketConnector()
{
SocketConnector result;
// FIXME - this needs to be sorted to use the new Mina MultiThread SA.
if (Boolean.getBoolean("qpidnio"))
{
_logger.warn("Using Qpid MultiThreaded NIO - " + (System.getProperties().containsKey("qpidnio")
? "Qpid NIO is new default"
: "Sysproperty 'qpidnio' is set"));
result = new MultiThreadSocketConnector(1, new QpidThreadExecutor());
}
else
{
_logger.info("Using Mina NIO");
result = new SocketConnector(1, new QpidThreadExecutor()); // non-blocking connector
}
// Don't have the connector's worker thread wait around for other connections (we only use
// one SocketConnector per connection at the moment anyway). This allows short-running
// clients (like unit tests) to complete quickly.
result.setWorkerTimeout(0);