JMSRemotingConnection remotingConnection = connectionDelegate.getRemotingConnection();
// install the consolidated remoting connection listener; it will be de-installed on
// connection closing by ConnectionAspect
ConsolidatedRemotingConnectionListener listener =
new ConsolidatedRemotingConnectionListener();
remotingConnection.addConnectionListener(listener);
if (versionToUse == null)
{
throw new IllegalStateException("Connection version is null");
}
// We have one message id generator per unique server
MessageIdGenerator idGenerator =
MessageIdGeneratorFactory.instance.checkOutGenerator(serverID);
ConnectionState connectionState =
new ConnectionState(serverID, connectionDelegate,
remotingConnection, versionToUse, idGenerator);
listener.setConnectionState(connectionState);
connectionDelegate.setState(connectionState);
}
return res;
}