@Override public boolean acquire(long delay) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); boolean success = false; if (delay <= 0) return attempt(); Semaphore semaphore = createSemaphore(); if (semaphore == null) return true; if (DEBUG) System.out.println("[" + Thread.currentThread() + "] Operation waiting to be executed... " + this); //$NON-NLS-1$ //$NON-NLS-2$ success = doAcquire(semaphore, delay); manager.resumeSuspendedLocks(Thread.currentThread()); if (DEBUG) System.out.println("[" + Thread.currentThread() + //$NON-NLS-1$ (success ? "] Operation started... " : "] Operation timed out... ") + this); //$NON-NLS-1$ //$NON-NLS-2$ //} if (!success && Thread.interrupted()) throw new InterruptedException(); return success; }
public boolean acquire(long delay) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); boolean success = false; if (delay <= 0) return attempt(); Semaphore semaphore = createSemaphore(); if (semaphore == null) return true; if (DEBUG) System.out.println("[" + Thread.currentThread() + "] Operation waiting to be executed... " + this); //$NON-NLS-1$ //$NON-NLS-2$ success = doAcquire(semaphore, delay); manager.resumeSuspendedLocks(Thread.currentThread()); if (DEBUG) System.out.println("[" + Thread.currentThread() + //$NON-NLS-1$ (success ? "] Operation started... " : "] Operation timed out... ") + this); //$NON-NLS-1$ //$NON-NLS-2$ //} if (!success && Thread.interrupted()) throw new InterruptedException(); return success; }
public boolean acquire(long delay) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); boolean success = false; if (delay <= 0) return attempt(); Semaphore semaphore = createSemaphore(); if (semaphore == null) return true; if (DEBUG) System.out.println("[" + Thread.currentThread() + "] Operation waiting to be executed... " + this); //$NON-NLS-1$ //$NON-NLS-2$ success = doAcquire(semaphore, delay); manager.resumeSuspendedLocks(Thread.currentThread()); if (DEBUG) System.out.println("[" + Thread.currentThread() + //$NON-NLS-1$ (success ? "] Operation started... " : "] Operation timed out... ") + this); //$NON-NLS-1$ //$NON-NLS-2$ //} return success; }
@Override public boolean acquire(long delay) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); boolean success = false; if (delay <= 0) return attempt(); Semaphore semaphore = createSemaphore(); if (semaphore == null) return true; if (DEBUG) System.out.println("[" + Thread.currentThread() + "] Operation waiting to be executed... " + this); //$NON-NLS-1$ //$NON-NLS-2$ success = doAcquire(semaphore, delay); manager.resumeSuspendedLocks(Thread.currentThread()); if (DEBUG) System.out.println("[" + Thread.currentThread() + //$NON-NLS-1$ (success ? "] Operation started... " : "] Operation timed out... ") + this); //$NON-NLS-1$ //$NON-NLS-2$ //} if (!success && Thread.interrupted()) throw new InterruptedException(); return success; }