protected void resolveAndDispatch ( final ChatChannel channel ) { NodeObject . Lock lock = new NodeObject . Lock ( "ChatChannel" , channel . getLockName ( ) ) ; _peerMan . performWithLock ( lock , new PeerManager . LockedOperation ( ) { public void run ( ) { ( ( CrowdNodeObject ) _peerMan . getNodeObject ( ) ) . addToHostedChannels ( channel ) ; finishResolveAndDispatch ( channel ) ; } public void fail ( String peerName ) { final List < UserMessage > msgs = _resolving . remove ( channel ) ; if ( peerName == null ) { log . warning ( "Failed to resolve chat channel due to lock failure" , "channel" , channel ) ; } else { // some other peer resolved this channel first, so forward any queued messages // directly to that node _peerMan . invokeNodeAction ( peerName , new ChannelAction ( channel ) { @ Override protected void execute ( ) { for ( final UserMessage msg : msgs ) { _channelMan . dispatchSpeak ( _channel , msg ) ; } } } ) ; } } } ) ; }
Resolves the channel specified in the supplied action and then dispatches it .