private void notifyUpdate() { if (condition != null && condition.check()) { condition = null; final CompletionHandler<Integer> localCompletionHandler = completionHandler; completionHandler = null; final FutureImpl<Integer> localFuture = future; future = null; isCompletionHandlerRegistered = false; try { onCloseInputSource(); notifyCompleted(localCompletionHandler); localFuture.result(compositeBuffer.remaining()); } catch(IOException e) { notifyFailure(localCompletionHandler, e); localFuture.failure(e); } } }
if (!isCompletionHandlerRegistered) { if (condition.check()) { notifyCompleted(completionHandler); return ReadyFutureImpl.create( compositeBuffer.remaining()); onOpenInputSource(); } catch (IOException e) { notifyFailure(completionHandler, e); return ReadyFutureImpl.create(e);
public boolean append(final Buffer buffer) { if (buffer == null) { return false; } lock.writeLock().lock(); try { if (isClosed) { buffer.dispose(); } else { final int addSize = buffer.remaining(); if (addSize > 0) { compositeBuffer.append(buffer); } notifyUpdate(); } } finally { lock.writeLock().unlock(); } return true; }
@Override public void skip(int length) { if (length > size()) { throw new IllegalStateException("Can not skip more bytes than available"); } compositeBuffer.position(compositeBuffer.position() + length); compositeBuffer.shrink(); }
@Override public void close() { lock.writeLock().lock(); try { if (!isClosed) { isClosed = true; compositeBuffer.dispose(); final CompletionHandler<Integer> localCompletionHandler = completionHandler; if (localCompletionHandler != null) { completionHandler = null; isCompletionHandlerRegistered = false; notifyFailure(localCompletionHandler, new EOFException("Input is closed")); } } } finally { lock.writeLock().unlock(); } }
if (!isCompletionHandlerRegistered) { if (condition.check()) { notifyCompleted(completionHandler); return ReadyFutureImpl.create( compositeBuffer.remaining()); onOpenInputSource(); } catch (IOException e) { notifyFailure(completionHandler, e); return ReadyFutureImpl.create(e);
public boolean append(final Buffer buffer) { if (buffer == null) { return false; } lock.writeLock().lock(); try { if (isClosed) { buffer.dispose(); } else { final int addSize = buffer.remaining(); if (addSize > 0) { compositeBuffer.append(buffer); } notifyUpdate(); } } finally { lock.writeLock().unlock(); } return true; }
@Override public void skip(int length) { if (length > size()) { throw new IllegalStateException("Can not skip more bytes than available"); } compositeBuffer.position(compositeBuffer.position() + length); compositeBuffer.shrink(); }
@Override public void close() { lock.writeLock().lock(); try { if (!isClosed) { isClosed = true; compositeBuffer.dispose(); final CompletionHandler<Integer> localCompletionHandler = completionHandler; if (localCompletionHandler != null) { completionHandler = null; isCompletionHandlerRegistered = false; notifyFailure(localCompletionHandler, new EOFException("Input is closed")); } } } finally { lock.writeLock().unlock(); } }
private void notifyUpdate() { if (condition != null && condition.check()) { condition = null; final CompletionHandler<Integer> localCompletionHandler = completionHandler; completionHandler = null; final FutureImpl<Integer> localFuture = future; future = null; isCompletionHandlerRegistered = false; try { onCloseInputSource(); notifyCompleted(localCompletionHandler); localFuture.result(compositeBuffer.remaining()); } catch(IOException e) { notifyFailure(localCompletionHandler, e); localFuture.failure(e); } } }
if (!isCompletionHandlerRegistered) { if (condition.check()) { notifyCompleted(completionHandler); return ReadyFutureImpl.create( compositeBuffer.remaining()); onOpenInputSource(); } catch (IOException e) { notifyFailure(completionHandler, e); return ReadyFutureImpl.create(e);
public boolean append(final Buffer buffer) { if (buffer == null) { return false; } lock.writeLock().lock(); try { if (isClosed) { buffer.dispose(); } else { final int addSize = buffer.remaining(); if (addSize > 0) { compositeBuffer.append(buffer); } notifyUpdate(); } } finally { lock.writeLock().unlock(); } return true; }
@Override public void skip(int length) { if (length > size()) { throw new IllegalStateException("Can not skip more bytes than available"); } compositeBuffer.position(compositeBuffer.position() + length); compositeBuffer.shrink(); }
@Override public void close() { lock.writeLock().lock(); try { if (!isClosed) { isClosed = true; compositeBuffer.dispose(); final CompletionHandler<Integer> localCompletionHandler = completionHandler; if (localCompletionHandler != null) { completionHandler = null; isCompletionHandlerRegistered = false; notifyFailure(localCompletionHandler, new EOFException("Input is closed")); } } } finally { lock.writeLock().unlock(); } }
private void notifyUpdate() { if (condition != null && condition.check()) { condition = null; final CompletionHandler<Integer> localCompletionHandler = completionHandler; completionHandler = null; final FutureImpl<Integer> localFuture = future; future = null; isCompletionHandlerRegistered = false; try { onCloseInputSource(); notifyCompleted(localCompletionHandler); localFuture.result(compositeBuffer.remaining()); } catch(IOException e) { notifyFailure(localCompletionHandler, e); localFuture.failure(e); } } }
if (!isCompletionHandlerRegistered) { if (condition.check()) { notifyCompleted(completionHandler); return ReadyFutureImpl.create( compositeBuffer.remaining()); onOpenInputSource(); } catch (IOException e) { notifyFailure(completionHandler, e); return ReadyFutureImpl.create(e);
public boolean append(final Buffer buffer) { if (buffer == null) { return false; } lock.writeLock().lock(); try { if (isClosed) { buffer.dispose(); } else { final int addSize = buffer.remaining(); if (addSize > 0) { compositeBuffer.append(buffer); } notifyUpdate(); } } finally { lock.writeLock().unlock(); } return true; }
@Override public void skip(int length) { if (length > size()) { throw new IllegalStateException("Can not skip more bytes than available"); } compositeBuffer.position(compositeBuffer.position() + length); compositeBuffer.shrink(); }
@Override public void close() { lock.writeLock().lock(); try { if (!isClosed) { isClosed = true; compositeBuffer.dispose(); final CompletionHandler<Integer> localCompletionHandler = completionHandler; if (localCompletionHandler != null) { completionHandler = null; isCompletionHandlerRegistered = false; notifyFailure(localCompletionHandler, new EOFException("Input is closed")); } } } finally { lock.writeLock().unlock(); } }
private void notifyUpdate() { if (condition != null && condition.check()) { condition = null; final CompletionHandler<Integer> localCompletionHandler = completionHandler; completionHandler = null; final FutureImpl<Integer> localFuture = future; future = null; isCompletionHandlerRegistered = false; try { onCloseInputSource(); notifyCompleted(localCompletionHandler); localFuture.result(compositeBuffer.remaining()); } catch(IOException e) { notifyFailure(localCompletionHandler, e); localFuture.failure(e); } } }