public Blocker acquire() throws IOException { _lock.lock(); long idle = getIdleTimeout(); try { while (_blocker._state != IDLE) { if (idle > 0 && (idle < Long.MAX_VALUE / 2)) { // Wait a little bit longer than the blocker might block if (!_idle.await(idle * 2, TimeUnit.MILLISECONDS)) throw new IOException(new TimeoutException()); } else _idle.await(); } _blocker._state = null; } catch (final InterruptedException e) { throw new InterruptedIOException(); } finally { _lock.unlock(); } return _blocker; }
/** * Check the Callback has succeeded or failed and after the return leave * in the state to allow reuse. */ @Override public void close() { _lock.lock(); try { if (_state == IDLE) throw new IllegalStateException("IDLE"); if (_state == null) notComplete(this); } finally { try { // If the blocker timed itself out, remember the state if (_state instanceof BlockerTimeoutException) // and create a new Blocker _blocker = new Blocker(); else // else reuse Blocker _state = IDLE; _idle.signalAll(); _complete.signalAll(); } finally { _lock.unlock(); } } }
/** * Check the Callback has succeeded or failed and after the return leave * in the state to allow reuse. */ @Override public void close() { _lock.lock(); try { if (_state == IDLE) throw new IllegalStateException("IDLE"); if (_state == null) notComplete(this); } finally { try { // If the blocker timed itself out, remember the state if (_state instanceof BlockerTimeoutException) // and create a new Blocker _blocker = new Blocker(); else // else reuse Blocker _state = IDLE; _idle.signalAll(); _complete.signalAll(); } finally { _lock.unlock(); } } }
public Blocker acquire() throws IOException { _lock.lock(); long idle = getIdleTimeout(); try { while (_blocker._state != IDLE) { if (idle > 0 && (idle < Long.MAX_VALUE / 2)) { // Wait a little bit longer than the blocker might block if (!_idle.await(idle * 2, TimeUnit.MILLISECONDS)) throw new IOException(new TimeoutException()); } else _idle.await(); } _blocker._state = null; } catch (final InterruptedException e) { throw new InterruptedIOException(); } finally { _lock.unlock(); } return _blocker; }
/** * Check the Callback has succeeded or failed and after the return leave * in the state to allow reuse. */ @Override public void close() { _lock.lock(); try { if (_state == IDLE) throw new IllegalStateException("IDLE"); if (_state == null) notComplete(this); } finally { try { // If the blocker timed itself out, remember the state if (_state instanceof BlockerTimeoutException) // and create a new Blocker _blocker = new Blocker(); else // else reuse Blocker _state = IDLE; _idle.signalAll(); _complete.signalAll(); } finally { _lock.unlock(); } } }
public Blocker acquire() throws IOException { _lock.lock(); long idle = getIdleTimeout(); try { while (_blocker._state != IDLE) { if (idle > 0 && (idle < Long.MAX_VALUE / 2)) { // Wait a little bit longer than the blocker might block if (!_idle.await(idle * 2, TimeUnit.MILLISECONDS)) throw new IOException(new TimeoutException()); } else _idle.await(); } _blocker._state = null; } catch (final InterruptedException e) { throw new InterruptedIOException(); } finally { _lock.unlock(); } return _blocker; }
long idle = getIdleTimeout(); try { while (_state == null) {
long idle = getIdleTimeout(); try { while (_state == null) {
long idle = getIdleTimeout(); try { while (_state == null) {