public DelayableImmutableMessage poll ( long timeout , TimeUnit unit ) throws InterruptedException { DelayableImmutableMessage message = delayableImmutableMessages . poll ( timeout , unit ) ; if ( message != null ) { messagePersister . remove ( messageQueueId , message ) ; } return message ; }
Polls the message queue for a period no longer than the timeout specified for a new message .