public void buffer(byte read) { pos = -1; if (byteBuffered >= maxBufferSize) { log.debug(() -> "Buffer size " + maxBufferSize + " has been exceeded and the input stream " + "will not be repeatable. Freeing buffer memory"); bufferSizeOverflow = true; } else { bufferArray[byteBuffered++] = read; } }
public void buffer(byte read) { pos = -1; if (byteBuffered >= maxBufferSize) { log.debug(() -> "Buffer size " + maxBufferSize + " has been exceeded and the input stream " + "will not be repeatable. Freeing buffer memory"); bufferSizeOverflow = true; } else { bufferArray[byteBuffered++] = read; } }
public void buffer(byte[] src, int srcPos, int length) { pos = -1; if (byteBuffered + length > maxBufferSize) { log.debug(() -> "Buffer size " + maxBufferSize + " has been exceeded and the input stream " + "will not be repeatable. Freeing buffer memory"); bufferSizeOverflow = true; } else { System.arraycopy(src, srcPos, bufferArray, byteBuffered, length); byteBuffered += length; } }
public void buffer(byte[] src, int srcPos, int length) { pos = -1; if (byteBuffered + length > maxBufferSize) { log.debug(() -> "Buffer size " + maxBufferSize + " has been exceeded and the input stream " + "will not be repeatable. Freeing buffer memory"); bufferSizeOverflow = true; } else { System.arraycopy(src, srcPos, bufferArray, byteBuffered, length); byteBuffered += length; } }
@Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { log.debug(() -> "Accepting a client certificate: " + x509Certificates[0].getSubjectDN()); }
/** * Create a chain that will execute the provided interceptors in the order they are provided. */ public ExecutionInterceptorChain(List<ExecutionInterceptor> interceptors) { this.interceptors = new ArrayList<>(Validate.paramNotNull(interceptors, "interceptors")); LOG.debug(() -> "Creating an interceptor chain that will apply interceptors in the following order: " + interceptors); }
@Override public void shutdownOutput() throws IOException { log.debug(() -> "shutting down output of " + endpoint()); sock.shutdownOutput(); } }
@Override public void connect(SocketAddress endpoint) throws IOException { log.trace(() -> "connecting to: " + endpoint); sock.connect(endpoint); log.debug(() -> "connected to: " + endpoint); }
@Override public void connect(SocketAddress endpoint, int timeout) throws IOException { log.trace(() -> "connecting to: " + endpoint); sock.connect(endpoint, timeout); log.debug(() -> "connected to: " + endpoint); }
@Override public int read() throws IOException { byte[] tmp = new byte[1]; int count = read(tmp, 0, 1); if (count != -1) { log.debug(() -> "One byte read from the stream."); int unsignedByte = (int) tmp[0] & 0xFF; return unsignedByte; } else { return count; } }
@Override public void close() throws IOException { log.debug(() -> "closing " + endpoint()); sock.close(); }
@Override public void shutdownInput() throws IOException { log.debug(() -> "shutting down input of " + endpoint()); sock.shutdownInput(); }
@Override public int read() throws IOException { byte[] tmp = new byte[1]; int count = read(tmp, 0, 1); if (count != -1) { log.debug(() -> "One byte read from the stream."); int unsignedByte = (int) tmp[0] & 0xFF; return unsignedByte; } else { return count; } }
@Override protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent event) { assert ctx.channel().eventLoop().inEventLoop(); boolean channelNotInUse = Boolean.FALSE.equals(ctx.channel().attr(ChannelAttributeKey.IN_USE).get()); if (channelNotInUse && ctx.channel().isOpen()) { log.debug(() -> "Closing unused connection (" + ctx.channel().id() + ") because it has been idle for longer than " + maxIdleTimeMillis + " milliseconds."); ctx.close(); } } }
@Override public Future<Void> release(Channel channel, Promise<Void> promise) { doInEventLoop(channel.eventLoop(), () -> { boolean shouldCloseOnRelease = Boolean.TRUE.equals(channel.attr(ChannelAttributeKey.CLOSE_ON_RELEASE).get()); if (shouldCloseOnRelease && channel.isOpen() && !channel.eventLoop().isShuttingDown()) { log.debug(() -> "Closing connection (" + channel.id() + "), instead of releasing it."); channel.close(); } delegatePool.release(channel, promise); }); return promise; }
@Override public void connect(SocketAddress endpoint) throws IOException { log.trace(() -> "connecting to: " + endpoint); sock.connect(endpoint); log.debug(() -> "connected to: " + endpoint); }
@Override public void connect(SocketAddress endpoint, int timeout) throws IOException { log.trace(() -> "connecting to: " + endpoint); sock.connect(endpoint, timeout); log.debug(() -> "connected to: " + endpoint); }
@Override public void close() throws IOException { log.debug(() -> "closing " + endpoint()); sock.close(); }
@Override public void shutdownInput() throws IOException { log.debug(() -> "shutting down input of " + endpoint()); sock.shutdownInput(); }
@Override public void shutdownOutput() throws IOException { log.debug(() -> "shutting down output of " + endpoint()); sock.shutdownOutput(); } }