use of com.swiftmq.net.client.ServerEntry in project swiftmq-client by iitsoftware.
the class ConnectionFactoryImpl method createReconnector.
private Reconnector createReconnector() throws JMSException {
PoolManager.setIntraVM(intraVM);
Reconnector reconnector = null;
if (intraVM) {
try {
List servers = new ArrayList();
servers.add(new ServerEntry("intravm", 0));
reconnector = new IntraVMReconnector(servers, null, false, 0, 0, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating intraVM connection, message: " + e.getMessage());
}
} else {
try {
List servers = new ArrayList();
servers.add(new ServerEntry(hostname, port));
if (reconnectEnabled && hostname2 != null)
servers.add(new ServerEntry(hostname2, port2));
Map parameters = new HashMap();
parameters.put(SwiftMQConnectionFactory.TCP_NO_DELAY, Boolean.valueOf(System.getProperty("swiftmq.tcp.no.delay", "true")));
parameters.put(SwiftMQConnectionFactory.INPUT_BUFFER_SIZE, new Integer(inputBufferSize));
parameters.put(SwiftMQConnectionFactory.INPUT_EXTEND_SIZE, new Integer(inputExtendSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_BUFFER_SIZE, new Integer(outputBufferSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_EXTEND_SIZE, new Integer(outputExtendSize));
SocketFactory sf = (SocketFactory) Class.forName(socketFactoryClass).newInstance();
if (sf instanceof SocketFactory2)
((SocketFactory2) sf).setReceiveBufferSize(inputBufferSize);
parameters.put(SwiftMQConnectionFactory.SOCKETFACTORY, sf);
reconnector = new BlockingReconnector(servers, parameters, reconnectEnabled, maxRetries, retryDelay, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating socket connection to " + hostname + ":" + port + ", message: " + e.getMessage());
}
}
return reconnector;
}
use of com.swiftmq.net.client.ServerEntry in project swiftmq-client by iitsoftware.
the class ConnectionFactoryImpl method createReconnector.
private Reconnector createReconnector() throws JMSException {
PoolManager.setIntraVM(intraVM);
Reconnector reconnector = null;
if (intraVM) {
try {
List servers = new ArrayList();
servers.add(new ServerEntry("intravm", 0));
reconnector = new IntraVMReconnector(servers, null, false, 0, 0, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating intraVM connection, message: " + e.getMessage());
}
} else {
try {
List servers = new ArrayList();
servers.add(new ServerEntry(hostname, port));
if (reconnectEnabled && hostname2 != null)
servers.add(new ServerEntry(hostname2, port2));
Map parameters = new HashMap();
parameters.put(SwiftMQConnectionFactory.TCP_NO_DELAY, Boolean.valueOf(System.getProperty("swiftmq.tcp.no.delay", "true")));
parameters.put(SwiftMQConnectionFactory.INPUT_BUFFER_SIZE, new Integer(inputBufferSize));
parameters.put(SwiftMQConnectionFactory.INPUT_EXTEND_SIZE, new Integer(inputExtendSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_BUFFER_SIZE, new Integer(outputBufferSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_EXTEND_SIZE, new Integer(outputExtendSize));
SocketFactory sf = (SocketFactory) Class.forName(socketFactoryClass).newInstance();
if (sf instanceof SocketFactory2)
((SocketFactory2) sf).setReceiveBufferSize(inputBufferSize);
parameters.put(SwiftMQConnectionFactory.SOCKETFACTORY, sf);
reconnector = new BlockingReconnector(servers, parameters, reconnectEnabled, maxRetries, retryDelay, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating socket connection to " + hostname + ":" + port + ", message: " + e.getMessage());
}
}
return reconnector;
}
use of com.swiftmq.net.client.ServerEntry in project swiftmq-client by iitsoftware.
the class ConnectionFactoryImpl method createReconnector.
private Reconnector createReconnector() throws JMSException {
PoolManager.setIntraVM(intraVM);
Reconnector reconnector = null;
if (intraVM) {
try {
List servers = new ArrayList();
servers.add(new ServerEntry("intravm", 0));
reconnector = new IntraVMReconnector(servers, null, false, 0, 0, false);
} catch (Exception e) {
throw new JMSException("error creating intraVM connection, message: " + e.getMessage());
}
} else {
try {
List servers = new ArrayList();
servers.add(new ServerEntry(hostname, port));
if (reconnectEnabled && hostname2 != null)
servers.add(new ServerEntry(hostname2, port2));
Map parameters = new HashMap();
parameters.put(SwiftMQConnectionFactory.TCP_NO_DELAY, Boolean.valueOf(System.getProperty("swiftmq.tcp.no.delay", "true")));
parameters.put(SwiftMQConnectionFactory.INPUT_BUFFER_SIZE, new Integer(inputBufferSize));
parameters.put(SwiftMQConnectionFactory.INPUT_EXTEND_SIZE, new Integer(inputExtendSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_BUFFER_SIZE, new Integer(outputBufferSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_EXTEND_SIZE, new Integer(outputExtendSize));
parameters.put(SwiftMQConnectionFactory.SOCKETFACTORY, (SocketFactory) Class.forName(socketFactoryClass).newInstance());
reconnector = new BlockingReconnector(servers, parameters, reconnectEnabled, maxRetries, retryDelay, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating socket connection to " + hostname + ":" + port + ", message: " + e.getMessage());
}
}
return reconnector;
}
use of com.swiftmq.net.client.ServerEntry in project swiftmq-client by iitsoftware.
the class ConnectionFactoryImpl method createReconnector.
private Reconnector createReconnector() throws JMSException {
PoolManager.setIntraVM(intraVM);
Reconnector reconnector = null;
if (intraVM) {
try {
List servers = new ArrayList();
servers.add(new ServerEntry("intravm", 0));
reconnector = new IntraVMReconnector(servers, null, false, 0, 0, false);
} catch (Exception e) {
throw new JMSException("error creating intraVM connection, message: " + e.getMessage());
}
} else {
try {
List servers = new ArrayList();
servers.add(new ServerEntry(hostname, port));
if (reconnectEnabled && hostname2 != null)
servers.add(new ServerEntry(hostname2, port2));
Map parameters = new HashMap();
parameters.put(SwiftMQConnectionFactory.TCP_NO_DELAY, Boolean.valueOf(System.getProperty("swiftmq.tcp.no.delay", "true")));
parameters.put(SwiftMQConnectionFactory.INPUT_BUFFER_SIZE, new Integer(inputBufferSize));
parameters.put(SwiftMQConnectionFactory.INPUT_EXTEND_SIZE, new Integer(inputExtendSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_BUFFER_SIZE, new Integer(outputBufferSize));
parameters.put(SwiftMQConnectionFactory.OUTPUT_EXTEND_SIZE, new Integer(outputExtendSize));
parameters.put(SwiftMQConnectionFactory.SOCKETFACTORY, (SocketFactory) Class.forName(socketFactoryClass).newInstance());
reconnector = new BlockingReconnector(servers, parameters, reconnectEnabled, maxRetries, retryDelay, Boolean.valueOf(System.getProperty("swiftmq.reconnect.debug", "false")).booleanValue());
} catch (Exception e) {
throw new JMSException("error creating socket connection to " + hostname + ":" + port + ", message: " + e.getMessage());
}
}
return reconnector;
}
Aggregations