/**
* Add a listener that will be invoked each time the underlying channel is created or destroyed. Used mainly by the various messaging components that need to do work on channel setup, and cleanup on channel loss.
* @param listener the callback that will be provided the channel.
*/
public void addChannelSetupListener(final ChannelListener listener){
synchronized (channelStateLock) {
setupListeners.add(listener);
}
executeIfChannelValid(new ChannelCallback(){
public void runWithChannel( Channel c) throws IOException {
listener.channelCreated(c);
}
}
);
}

Example 7

From project accesointeligente, under directory /src/org/accesointeligente/server/.