public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }
public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }
public void close() { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case IDLE: case SUCCEEDED: case FAILED: _state = State.CLOSED; break; case CLOSED: break; default: _state = State.CLOSED; failure = true; } } if (failure) onCompleteFailure(new ClosedChannelException()); }
/** * Invoked when the sub task fails. * Subclasses that override this method must always remember to call * {@code super.failed(Throwable)}. */ @Override public void failed(Throwable x) { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case SUCCEEDED: case FAILED: case IDLE: case CLOSED: case CALLED: // too late!. break; case PENDING: case PROCESSING: { _state = State.FAILED; failure = true; break; } default: throw new IllegalStateException(toString()); } } if (failure) onCompleteFailure(x); }
/** * Invoked when the sub task fails. * Subclasses that override this method must always remember to call * {@code super.failed(Throwable)}. */ @Override public void failed(Throwable x) { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case SUCCEEDED: case FAILED: case IDLE: case CLOSED: case CALLED: // too late!. break; case PENDING: case PROCESSING: { _state = State.FAILED; failure = true; break; } default: throw new IllegalStateException(toString()); } } if (failure) onCompleteFailure(x); }
/** * Invoked when the sub task fails. Subclasses that override this method * must always remember to call {@code super.failed(Throwable)}. */ @Override public void failed(Throwable x) { boolean failure = false; try (Locker.Lock lock = _locker.lock()) { switch (_state) { case SUCCEEDED: case FAILED: case IDLE: case CLOSED: case CALLED: // too late!. break; case PENDING: case PROCESSING: { _state = State.FAILED; failure = true; break; } default: throw new IllegalStateException(toString()); } } if (failure) onCompleteFailure(x); }