public boolean awaitUntil(Date deadline) throws InterruptedException { if (deadline == null) throw new NullPointerException(); int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { long start = System.currentTimeMillis(); for (int i=holdCount; i>0; i--) lock.lock();
public synchronized void signal() { if (!lock.isHeldByCurrentThread()) { throw new IllegalMonitorStateException(); } notify(); }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { if (nanos > 0) { for (int i=holdCount; i>0; i--) lock.lock();
public boolean awaitUntil(Date deadline) throws InterruptedException { if (deadline == null) throw new NullPointerException(); int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { long start = System.currentTimeMillis(); for (int i=holdCount; i>0; i--) lock.lock();
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { if (nanos > 0) { for (int i=holdCount; i>0; i--) lock.lock();
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { if (nanos > 0) { for (int i=holdCount; i>0; i--) lock.lock();
public boolean awaitUntil(Date deadline) throws InterruptedException { if (deadline == null) throw new NullPointerException(); int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { long start = System.currentTimeMillis(); for (int i=holdCount; i>0; i--) lock.lock();
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } // avoid instant spurious wakeup if thread already interrupted boolean wasInterrupted = Thread.interrupted(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // may have masked the signal and there is no way // to tell; we must wake up spuriously } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); if (wasInterrupted) { Thread.currentThread().interrupt(); } } }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } // avoid instant spurious wakeup if thread already interrupted boolean wasInterrupted = Thread.interrupted(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // may have masked the signal and there is no way // to tell; we must wake up spuriously } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); if (wasInterrupted) { Thread.currentThread().interrupt(); } } }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } // avoid instant spurious wakeup if thread already interrupted boolean wasInterrupted = Thread.interrupted(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // may have masked the signal and there is no way // to tell; we must wake up spuriously } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); if (wasInterrupted) { Thread.currentThread().interrupt(); } } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { notify(); throw ex; } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { notify(); throw ex; } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); try { synchronized (this) { for (int i=holdCount; i>0; i--) lock.unlock(); try { wait(); } catch (InterruptedException ex) { notify(); throw ex; } } } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWaitUninterruptibly(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }