Code example for BlockingQueue

Methods: take

0
    } 
 
    @Override 
    public Object takeTask() {
        try { 
            return taskQueue.take();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } 
    } 
 
    @Override 
    public void executeTask(Object task) {
        ((Runnable) task).run();
    } 
 
    @Override 
    public boolean workAvailable() { 
        return taskQueue.size() > 0;
    }