public <T> void addIncoming(Class<T> type, T handler) {
String channelKey = type.getName();
lock.lock();
try {
if (channels.add(channelKey)) {
protocolStack.getTop().dispatch(new ChannelAvailable(messageOriginator, group, channelKey, address));
}
} finally {
lock.unlock();
}
hub.addIncoming(channelKey, new TypeCastDispatch<MethodInvocation, Object>(MethodInvocation.class, new ReflectionDispatch(handler)));