/** * 阻塞等待Boolean为true,允许设置超时时间 * * @param timeout * @param unit * @throws InterruptedException * @throws TimeoutException */ public void lockTimeOut(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { sync.innerLock(unit.toNanos(timeout)); }
/** * 阻塞等待Boolean为true * * @throws InterruptedException */ public void lock() throws InterruptedException { sync.innerLock(); }