Search in sources :

Example 1 with IntraVMConnection

use of com.swiftmq.net.client.IntraVMConnection 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);
            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;
}
Also used : IntraVMConnection(com.swiftmq.net.client.IntraVMConnection) SocketFactory(com.swiftmq.net.SocketFactory) NetworkSwiftlet(com.swiftmq.swiftlet.net.NetworkSwiftlet) BlockingConnection(com.swiftmq.net.client.BlockingConnection) IOException(java.io.IOException) NamingException(javax.naming.NamingException) Socket(java.net.Socket)

Example 2 with IntraVMConnection

use of com.swiftmq.net.client.IntraVMConnection 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);
            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;
}
Also used : IntraVMConnection(com.swiftmq.net.client.IntraVMConnection) SocketFactory(com.swiftmq.net.SocketFactory) NetworkSwiftlet(com.swiftmq.swiftlet.net.NetworkSwiftlet) BlockingConnection(com.swiftmq.net.client.BlockingConnection) IOException(java.io.IOException) NamingException(javax.naming.NamingException) Socket(java.net.Socket)

Example 3 with IntraVMConnection

use of com.swiftmq.net.client.IntraVMConnection 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;
}
Also used : IntraVMConnection(com.swiftmq.net.client.IntraVMConnection) SocketFactory(com.swiftmq.net.SocketFactory) NetworkSwiftlet(com.swiftmq.swiftlet.net.NetworkSwiftlet) BlockingConnection(com.swiftmq.net.client.BlockingConnection) IOException(java.io.IOException) NamingException(javax.naming.NamingException) Socket(java.net.Socket)

Aggregations

SocketFactory (com.swiftmq.net.SocketFactory)3 BlockingConnection (com.swiftmq.net.client.BlockingConnection)3 IntraVMConnection (com.swiftmq.net.client.IntraVMConnection)3 NetworkSwiftlet (com.swiftmq.swiftlet.net.NetworkSwiftlet)3 IOException (java.io.IOException)3 Socket (java.net.Socket)3 NamingException (javax.naming.NamingException)3