@Override public void completed(Integer nBytes, SocketWrapperBase<Nio2Channel> attachment) { if (nBytes.intValue() < 0) { failed(new ClosedChannelException(), attachment); return; } getEndpoint().processSocket(attachment, SocketEvent.OPEN_READ, Nio2Endpoint.isInline()); }
@Override public void registerWriteInterest() { synchronized (writeCompletionHandler) { if (writePending.availablePermits() == 0) { writeInterest = true; } else { // If no write is pending, notify getEndpoint().processSocket(this, SocketEvent.OPEN_WRITE, true); } } }
@Override public void failed(Throwable exc, SocketWrapperBase<Nio2Channel> attachment) { IOException ioe; if (exc instanceof IOException) { ioe = (IOException) exc; } else { ioe = new IOException(exc); } setError(ioe); if (exc instanceof AsynchronousCloseException) { // Release here since there will be no // notify/dispatch to do the release. readPending.release(); // If already closed, don't call onError and close again return; } getEndpoint().processSocket(attachment, SocketEvent.ERROR, true); } };
switch (attachment.keepAliveState) { case NONE: { getEndpoint().processSocket(Nio2SocketWrapper.this, SocketEvent.DISCONNECT, false); break; getEndpoint().processSocket(Nio2SocketWrapper.this, SocketEvent.OPEN_READ, true); break;
@Override public void completed(Integer nBytes, SocketWrapperBase<Nio2Channel> attachment) { boolean notify = false; if (log.isDebugEnabled()) { log.debug("Socket: [" + attachment + "], Interest: [" + readInterest + "]"); } synchronized (readCompletionHandler) { if (nBytes.intValue() < 0) { failed(new EOFException(), attachment); } else { if (readInterest && !Nio2Endpoint.isInline()) { readInterest = false; notify = true; } else { // Release here since there will be no // notify/dispatch to do the release. readPending.release(); } } } if (notify) { getEndpoint().processSocket(attachment, SocketEvent.OPEN_READ, false); } } @Override
@Override public void failed(Throwable exc, SendfileData attachment) { try { attachment.fchannel.close(); } catch (IOException e) { // Ignore } if (!isInline()) { getEndpoint().processSocket(Nio2SocketWrapper.this, SocketEvent.ERROR, false); } else { attachment.doneInline = true; attachment.error = true; } } };
@Override public void failed(Throwable exc, SocketWrapperBase<Nio2Channel> attachment) { getEndpoint().processSocket(attachment, SocketEvent.DISCONNECT, true); } };
/** * {@inheritDoc} * @param clientCertProvider Ignored for this implementation */ @Override public SSLSupport getSslSupport(String clientCertProvider) { if (getSocket() instanceof SecureNio2Channel) { SecureNio2Channel ch = (SecureNio2Channel) getSocket(); SSLSession session = ch.getSslEngine().getSession(); return ((Nio2Endpoint) getEndpoint()).getSslImplementation().getSSLSupport(session); } else { return null; } }