Search in sources :

Example 1 with ConnectionVetoException

use of com.swiftmq.swiftlet.net.ConnectionVetoException in project swiftmq-ce by iitsoftware.

the class IntraVMScheduler method connectListener.

public synchronized void connectListener(String swiftletName, IntraVMConnection clientConnection) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$net", toString() + "/connectListener: swiftletName=" + swiftletName + ", clientConnection=" + clientConnection);
    IntraVMListenerMetaData metaData = (IntraVMListenerMetaData) listeners.get(swiftletName);
    if (metaData == null)
        throw new Exception("No intra-VM listener found for Swiftlet '" + swiftletName + "'");
    IntraVMServerEndpointImpl connection = new IntraVMServerEndpointImpl(ctx, clientConnection);
    try {
        ConnectionListener connectionListener = metaData.getConnectionListener();
        connection.setConnectionListener(connectionListener);
        connection.setMetaData(metaData);
        connectionListener.connected(connection);
        ctx.networkSwiftlet.getConnectionManager().addConnection(connection);
    } catch (ConnectionVetoException cve) {
        connection.close();
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$net", toString() + "/ConnectionVetoException: " + cve.getMessage());
        ctx.logSwiftlet.logError("sys$net", toString() + "/ConnectionVetoException: " + cve.getMessage());
        throw new Exception(cve.getMessage());
    }
    ctx.logSwiftlet.logInformation("sys$net", toString() + "/connection accepted: " + connection);
}
Also used : IntraVMListenerMetaData(com.swiftmq.swiftlet.net.IntraVMListenerMetaData) ConnectionVetoException(com.swiftmq.swiftlet.net.ConnectionVetoException) ConnectionListener(com.swiftmq.swiftlet.net.event.ConnectionListener) ConnectionVetoException(com.swiftmq.swiftlet.net.ConnectionVetoException)

Aggregations

ConnectionVetoException (com.swiftmq.swiftlet.net.ConnectionVetoException)1 IntraVMListenerMetaData (com.swiftmq.swiftlet.net.IntraVMListenerMetaData)1 ConnectionListener (com.swiftmq.swiftlet.net.event.ConnectionListener)1