@ Override public void send ( final Object message ) throws MessageTransportException { if ( shutdown . get ( ) ) throw new MessageTransportException ( "send called on shutdown queue." ) ; if ( blocking ) { while ( true ) { try { queue . put ( message ) ; if ( statsCollector != null ) statsCollector . messageSent ( message ) ; break ; } catch ( final InterruptedException ie ) { if ( shutdown . get ( ) ) throw new MessageTransportException ( "Shutting down durring send." ) ; } } } else { if ( ! queue . offer ( message ) ) { if ( statsCollector != null ) statsCollector . messageNotSent ( ) ; throw new MessageTransportException ( "Failed to queue message due to capacity." ) ; } else if ( statsCollector != null ) statsCollector . messageSent ( message ) ; } }
Send a message into the BlockingQueueAdaptor .