/** Cancels all transfers. */ public synchronized void shutdown() throws InterruptedException { for (Companion companion : _companions.values()) { companion.cancel("Pool is going down"); } while (!_companions.isEmpty()) { wait(); } }
synchronized int getId() throws InterruptedException { while (_id == -1) { wait(); } return _id; }