class TransportFilter extends Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.lang.Void,java.nio.ByteBuffer>
write(ByteBuffer,
org.glassfish.jersey.jdk.connector.internal.CompletionHandler)
method call can be processed at a time. Only one _read(ByteBuffer)
operation is supported at a time,
another one is started only after the previous one has completed. Blocking in Filter.onRead(Object)
or Filter.onConnect()
method will result in data not being read from a socket until these methods have completed.Modifier and Type | Class and Description |
---|---|
private static class |
TransportFilter.QueuingExecutor
A thread pool executor that prefers creating new worker threads over queueing tasks until the maximum poll size
has been reached, after which it will start queueing tasks.
|
private static class |
TransportFilter.TransportThreadFactory
A default thread factory that gets used if
ThreadPoolConfig.getThreadFactory()
is not specified. |
Modifier and Type | Field and Description |
---|---|
private static java.nio.channels.AsynchronousChannelGroup |
channelGroup |
private static java.util.concurrent.ScheduledFuture<?> |
closeWaitTask |
private static java.util.concurrent.ScheduledExecutorService |
connectionCloseScheduler |
private int |
containerIdleTimeout |
private static java.lang.Integer |
currentContainerIdleTimeout
Idle timeout that will be used when closing current
channelGroup |
private static ThreadPoolConfig |
currentThreadPoolConfig
ThreadPoolConfig current channelGroup has been created with. |
private int |
inputBufferSize |
private static java.util.logging.Logger |
LOGGER |
private static java.util.concurrent.atomic.AtomicInteger |
openedConnections |
private java.nio.channels.AsynchronousSocketChannel |
socketChannel |
private ThreadPoolConfig |
threadPoolConfig |
downstreamFilter, upstreamFilter
Constructor and Description |
---|
TransportFilter(int inputBufferSize,
ThreadPoolConfig threadPoolConfig,
int containerIdleTimeout)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
_read(java.nio.ByteBuffer inputBuffer) |
(package private) void |
close()
Close the filter, invokes close operation on the next filter in the filter chain.
|
void |
handleConnect(java.net.SocketAddress serverAddress,
Filter upstreamFilter)
|
private void |
initializeChannelGroup() |
private void |
scheduleClose() |
(package private) void |
startSsl()
Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.
|
private void |
updateThreadPoolConfig() |
(package private) void |
write(java.nio.ByteBuffer data,
CompletionHandler<java.nio.ByteBuffer> completionHandler)
Perform write operation for this filter and invokes write method on the next filter in the filter chain.
|
connect, onConnect, onConnectionClosed, onError, onRead, onSslHandshakeCompleted, processConnect, processConnectionClosed, processError, processRead, processSslHandshakeCompleted
private static final java.util.logging.Logger LOGGER
private static final java.util.concurrent.atomic.AtomicInteger openedConnections
private static final java.util.concurrent.ScheduledExecutorService connectionCloseScheduler
private static volatile java.nio.channels.AsynchronousChannelGroup channelGroup
private static volatile java.util.concurrent.ScheduledFuture<?> closeWaitTask
private static volatile ThreadPoolConfig currentThreadPoolConfig
ThreadPoolConfig
current channelGroup
has been created with.private static volatile java.lang.Integer currentContainerIdleTimeout
channelGroup
private final int inputBufferSize
private final ThreadPoolConfig threadPoolConfig
private final int containerIdleTimeout
private volatile java.nio.channels.AsynchronousSocketChannel socketChannel
TransportFilter(int inputBufferSize, ThreadPoolConfig threadPoolConfig, int containerIdleTimeout)
inputBufferSize
- size of buffer to be allocated for reading data from a socket.threadPoolConfig
- thread pool configuration used for creating thread pool.containerIdleTimeout
- idle time after which the shared thread pool will be destroyed.void write(java.nio.ByteBuffer data, CompletionHandler<java.nio.ByteBuffer> completionHandler)
Filter
void close()
Filter
void startSsl()
Filter
public void handleConnect(java.net.SocketAddress serverAddress, Filter upstreamFilter)
Filter
handleConnect
in class Filter<java.nio.ByteBuffer,java.nio.ByteBuffer,java.lang.Void,java.nio.ByteBuffer>
serverAddress
- an address where to connect (server or proxy).upstreamFilter
- a filter positioned upstream.Filter.connect(SocketAddress, Filter)
private void updateThreadPoolConfig()
private void initializeChannelGroup() throws java.io.IOException
java.io.IOException
private void _read(java.nio.ByteBuffer inputBuffer)
private void scheduleClose()