Code example for Condition

Methods: signalAll

0
        this.condition = condition;
    } 
 
    public void dispatch(InterHubMessage message) {
        queue.add(message);
        condition.signalAll();
    } 
 
    public void take(Collection<InterHubMessage> drainTo) {
        if (queue.isEmpty()) {
            owner.empty(this);
        } 
        while (queue.isEmpty()) {
            try { 
                condition.await();
            } catch (InterruptedException e) {
                throw UncheckedException.throwAsUncheckedException(e);
            } 
        } 
        drainTo.addAll(queue);