Search in sources :

Example 1 with NetworkSwiftlet

use of com.swiftmq.swiftlet.net.NetworkSwiftlet in project swiftmq-client by iitsoftware.

the class IntraVMReconnector method createConnection.

protected Connection createConnection(ServerEntry entry, Map parameters) {
    Connection connection = null;
    try {
        connection = new IntraVMConnection();
        NetworkSwiftlet networkSwiftlet = (NetworkSwiftlet) SwiftletManager.getInstance().getSwiftlet("sys$net");
        networkSwiftlet.connectIntraVMListener("sys$jms", (IntraVMConnection) connection);
    } catch (Exception e) {
        if (debug)
            System.out.println(toString() + " exception creating connection: " + e);
    }
    return connection;
}
Also used : NetworkSwiftlet(com.swiftmq.swiftlet.net.NetworkSwiftlet)

Example 2 with NetworkSwiftlet

use of com.swiftmq.swiftlet.net.NetworkSwiftlet 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 NetworkSwiftlet

use of com.swiftmq.swiftlet.net.NetworkSwiftlet 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 4 with NetworkSwiftlet

use of com.swiftmq.swiftlet.net.NetworkSwiftlet 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

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