public class SocketChannelDispatcher<E extends Event<SocketChannel>> extends Object implements AsyncChannelDispatcher
| Modifier and Type | Field and Description |
|---|---|
private BlockingQueue<ByteBuffer> |
bufferPool |
private Charset |
charset |
private SslContextFactory.ClientAuth |
clientAuth |
private AtomicInteger |
currentConnections |
private EventFactory<E> |
eventFactory |
private BlockingQueue<E> |
events |
private ExecutorService |
executor |
private ChannelHandlerFactory<E,AsyncChannelDispatcher> |
handlerFactory |
private BlockingQueue<SelectionKey> |
keyQueue |
private ComponentLog |
logger |
private int |
maxConnections |
private Selector |
selector |
private SSLContext |
sslContext |
private boolean |
stopped |
| Constructor and Description |
|---|
SocketChannelDispatcher(EventFactory<E> eventFactory,
ChannelHandlerFactory<E,AsyncChannelDispatcher> handlerFactory,
BlockingQueue<ByteBuffer> bufferPool,
BlockingQueue<E> events,
ComponentLog logger,
int maxConnections,
SSLContext sslContext,
Charset charset) |
SocketChannelDispatcher(EventFactory<E> eventFactory,
ChannelHandlerFactory<E,AsyncChannelDispatcher> handlerFactory,
BlockingQueue<ByteBuffer> bufferPool,
BlockingQueue<E> events,
ComponentLog logger,
int maxConnections,
SSLContext sslContext,
SslContextFactory.ClientAuth clientAuth,
Charset charset) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBackForSelection(SelectionKey key)
Informs the dispatcher that the connection for the given key can be added back for selection.
|
void |
close()
Closes all listeners and stops all handler threads.
|
void |
completeConnection(SelectionKey key)
Informs the dispatcher that the connection for the given key is complete.
|
int |
getPort() |
void |
open(InetAddress nicAddress,
int port,
int maxBufferSize)
Opens the dispatcher listening on the given port and attempts to set the
OS socket buffer to maxBufferSize.
|
void |
run() |
private final EventFactory<E extends Event<SocketChannel>> eventFactory
private final ChannelHandlerFactory<E extends Event<SocketChannel>,AsyncChannelDispatcher> handlerFactory
private final BlockingQueue<ByteBuffer> bufferPool
private final BlockingQueue<E extends Event<SocketChannel>> events
private final ComponentLog logger
private final int maxConnections
private final SSLContext sslContext
private final SslContextFactory.ClientAuth clientAuth
private final Charset charset
private ExecutorService executor
private volatile boolean stopped
private Selector selector
private final BlockingQueue<SelectionKey> keyQueue
private final AtomicInteger currentConnections
public SocketChannelDispatcher(EventFactory<E> eventFactory, ChannelHandlerFactory<E,AsyncChannelDispatcher> handlerFactory, BlockingQueue<ByteBuffer> bufferPool, BlockingQueue<E> events, ComponentLog logger, int maxConnections, SSLContext sslContext, Charset charset)
public SocketChannelDispatcher(EventFactory<E> eventFactory, ChannelHandlerFactory<E,AsyncChannelDispatcher> handlerFactory, BlockingQueue<ByteBuffer> bufferPool, BlockingQueue<E> events, ComponentLog logger, int maxConnections, SSLContext sslContext, SslContextFactory.ClientAuth clientAuth, Charset charset)
public void open(InetAddress nicAddress, int port, int maxBufferSize) throws IOException
ChannelDispatcheropen in interface ChannelDispatchernicAddress - the local network interface to listen on, if null will listen on the wildcard address
which means listening on all local network interfacesport - the port to listen onmaxBufferSize - the size to set the OS socket buffer toIOException - if an error occurred listening on the given portpublic int getPort()
getPort in interface ChannelDispatcherpublic void close()
ChannelDispatcherclose in interface ChannelDispatcherpublic void completeConnection(SelectionKey key)
AsyncChannelDispatchercompleteConnection in interface AsyncChannelDispatcherkey - a key that was previously selectedpublic void addBackForSelection(SelectionKey key)
AsyncChannelDispatcheraddBackForSelection in interface AsyncChannelDispatcherkey - a key that was previously selectedCopyright © 2019 Apache NiFi Project. All rights reserved.