use of com.swiftmq.net.SocketFactory in project swiftmq-client by iitsoftware.
the class BlockingReconnector method createConnection.
protected Connection createConnection(ServerEntry entry, Map parameters) {
Connection connection = null;
try {
boolean tcpNoDelay = ((Boolean) parameters.get(SwiftMQConnectionFactory.TCP_NO_DELAY)).booleanValue();
int inputBufferSize = ((Integer) parameters.get(SwiftMQConnectionFactory.INPUT_BUFFER_SIZE)).intValue();
int inputExtendSize = ((Integer) parameters.get(SwiftMQConnectionFactory.INPUT_EXTEND_SIZE)).intValue();
int outputBufferSize = ((Integer) parameters.get(SwiftMQConnectionFactory.OUTPUT_BUFFER_SIZE)).intValue();
int outputExtendSize = ((Integer) parameters.get(SwiftMQConnectionFactory.OUTPUT_EXTEND_SIZE)).intValue();
SocketFactory socketFactory = (SocketFactory) parameters.get(SwiftMQConnectionFactory.SOCKETFACTORY);
Socket socket = socketFactory.createSocket(entry.getHostname(), entry.getPort(), tcpNoDelay);
connection = new BlockingConnection(socket, inputBufferSize, inputExtendSize, outputBufferSize, outputExtendSize);
} catch (Exception e) {
if (debug)
System.out.println(toString() + " exception creating connection: " + e);
}
return connection;
}
use of com.swiftmq.net.SocketFactory in project swiftmq-ce by iitsoftware.
the class IOScheduler method getSocketFactory.
private SocketFactory getSocketFactory(String className) throws Exception {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$net", toString() + "/getSocketFactory: className=" + className);
SocketFactory sf = (SocketFactory) socketFactories.get(className);
if (sf == null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$net", toString() + "/getSocketFactory: className=" + className + ", creating...");
sf = (SocketFactory) Class.forName(className).newInstance();
socketFactories.put(className, sf);
}
return sf;
}
use of com.swiftmq.net.SocketFactory in project swiftmq-client by iitsoftware.
the class ConnectionFactoryImpl method createServerConnection.
private com.swiftmq.net.client.Connection createServerConnection() throws JMSException {
PoolManager.setIntraVM(intraVM);
com.swiftmq.net.client.Connection conn = null;
if (intraVM) {
try {
conn = new IntraVMConnection();
NetworkSwiftlet networkSwiftlet = (NetworkSwiftlet) SwiftletManager.getInstance().getSwiftlet("sys$net");
networkSwiftlet.connectIntraVMListener("sys$jms", (IntraVMConnection) conn);
} catch (Exception e) {
throw new JMSException("error creating intraVM connection, message: " + e.getMessage());
}
} else {
try {
if (socketFactory == null)
socketFactory = (SocketFactory) Class.forName(socketFactoryClass).newInstance();
Socket socket = socketFactory.createSocket(hostname, port, Boolean.valueOf(System.getProperty("swiftmq.tcp.no.delay", "true")).booleanValue());
conn = new BlockingConnection(socket, inputBufferSize, inputExtendSize, outputBufferSize, outputExtendSize);
} catch (Exception e) {
throw new JMSException("error creating socket connection to " + hostname + ":" + port + ", message: " + e.getMessage());
}
}
return conn;
}
Aggregations