public class DatagramChannelDispatcher<E extends Event<DatagramChannel>> extends Object implements ChannelDispatcher
| Modifier and Type | Field and Description |
|---|---|
private BlockingQueue<ByteBuffer> |
bufferPool |
private DatagramChannel |
datagramChannel |
private EventFactory<E> |
eventFactory |
private EventQueue<E> |
events |
private ComponentLog |
logger |
private Selector |
selector |
private String |
sendingHost |
private Integer |
sendingPort |
private boolean |
stopped |
| Constructor and Description |
|---|
DatagramChannelDispatcher(EventFactory<E> eventFactory,
BlockingQueue<ByteBuffer> bufferPool,
BlockingQueue<E> events,
ComponentLog logger) |
DatagramChannelDispatcher(EventFactory<E> eventFactory,
BlockingQueue<ByteBuffer> bufferPool,
BlockingQueue<E> events,
ComponentLog logger,
String sendingHost,
Integer sendingPort) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all listeners and stops all handler threads.
|
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<DatagramChannel>> eventFactory
private final BlockingQueue<ByteBuffer> bufferPool
private final EventQueue<E extends Event<DatagramChannel>> events
private final ComponentLog logger
private final String sendingHost
private final Integer sendingPort
private Selector selector
private DatagramChannel datagramChannel
private volatile boolean stopped
public DatagramChannelDispatcher(EventFactory<E> eventFactory, BlockingQueue<ByteBuffer> bufferPool, BlockingQueue<E> events, ComponentLog logger)
public DatagramChannelDispatcher(EventFactory<E> eventFactory, BlockingQueue<ByteBuffer> bufferPool, BlockingQueue<E> events, ComponentLog logger, String sendingHost, Integer sendingPort)
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 ChannelDispatcherCopyright © 2019 Apache NiFi Project. All rights reserved.