http://cs.oswego.edu/pipermail/concurrency-interest/2002-January/000000.html.
В качестве отправной точки взять такой пример кода:
class RebindableCondition implements Condition {
private Condition delegee;
public RebindableCondition(Condition delegee) {
this.delegee = delegee;
}
public void await()
throws InterruptedException {
delegee.await();
}
public void awaitUninterruptibly() {
delegee.awaitUninterruptibly();
}
public long awaitNanos(long nanosTimeout)
throws InterruptedException {
return delegee.awaitNanos(nanosTimeout);
}
public boolean await(long time, TimeUnit unit)
throws InterruptedException {
return delegee.await(time, unit);
}
public boolean awaitUntil(Date deadline)
throws InterruptedException {
return delegee.awaitUntil(deadline);
}
public void signal() {
delegee.signal();
}
public void signalAll() {
delegee.signalAll();
}
public void rebind(Condition newDelegee) {
this.delegee = newDelegee;
}
}Компоненты:
1) конструктор, инициализирующий поле this.delegee;
2) все методы интерфейса Condition делегируются полю this.delegee;
3) метод rebind(Condition newDelegee) позволяет "сменить" this.delegee.
