private void notifyConsumer ( AbstractMessage message ) { consumersLock . readLock ( ) . lock ( ) ; try { switch ( localConsumers . size ( ) ) { case 0 : return ; // Nobody's listening case 1 : notifySingleConsumer ( localConsumers . get ( 0 ) , message ) ; break ; default : // Multiple consumers notifyNextConsumer ( localConsumers , message ) ; break ; } } finally { consumersLock . readLock ( ) . unlock ( ) ; } }
Notify a consumer that a message is probably available for it to retrieve