Code example for LinkedBlockingQueue

Methods: poll

0
        return timeout;
    } 
     
    //this is the blocking code  
    public synchronized String getNextMessage(int timeout) throws InterruptedException {
        return queue.poll( timeout, TimeUnit.SECONDS );
    } 
 
    public synchronized String getNextMessage() {
        return queue.poll();
    } 
     
    public int getOptions() { 
        return options;
    } 
}