public final class ChannelListener extends Object
| Modifier and Type | Field and Description |
|---|---|
private BufferPool |
bufferPool |
private ChannelDispatcher |
channelDispatcher |
private long |
channelReaderFrequencyMSecs |
private ScheduledExecutorService |
executor |
private int |
initialBufferPoolSize |
private static org.slf4j.Logger |
LOGGER |
private Selector |
serverSocketSelector |
private Selector |
socketChannelSelector |
| Constructor and Description |
|---|
ChannelListener(int threadPoolSize,
StreamConsumerFactory consumerFactory,
BufferPool bufferPool,
int timeout,
TimeUnit unit,
boolean readSingleDatagram) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDatagramChannel(InetAddress nicIPAddress,
int port,
int receiveBufferSize)
Binds to listen for data grams on the given local IPAddress/port
|
void |
addDatagramChannel(InetAddress nicIPAddress,
int port,
int receiveBufferSize,
String sendingHost,
Integer sendingPort)
Binds to listen for data grams on the given local IPAddress/port and
restricts receipt of datagrams to those from the provided host and port,
must specify both.
|
void |
addServerSocket(InetAddress nicIPAddress,
int port,
int receiveBufferSize)
Adds a server socket channel for listening to connections.
|
private DatagramChannel |
createAndBindDatagramChannel(InetAddress nicIPAddress,
int port,
int receiveBufferSize) |
void |
setChannelReaderSchedulingPeriod(long period,
TimeUnit unit) |
void |
shutdown(long period,
TimeUnit timeUnit) |
private static final org.slf4j.Logger LOGGER
private final ScheduledExecutorService executor
private final Selector serverSocketSelector
private final Selector socketChannelSelector
private final ChannelDispatcher channelDispatcher
private final BufferPool bufferPool
private final int initialBufferPoolSize
private volatile long channelReaderFrequencyMSecs
public ChannelListener(int threadPoolSize,
StreamConsumerFactory consumerFactory,
BufferPool bufferPool,
int timeout,
TimeUnit unit,
boolean readSingleDatagram)
throws IOException
IOExceptionpublic void setChannelReaderSchedulingPeriod(long period,
TimeUnit unit)
public void addServerSocket(InetAddress nicIPAddress, int port, int receiveBufferSize) throws IOException
nicIPAddress - - if null binds to wildcard addressport - - port to bind toreceiveBufferSize - - size of OS receive buffer to request. If less
than 0 then will not be set and OS default will win.IOException - if unable to add socketpublic void addDatagramChannel(InetAddress nicIPAddress, int port, int receiveBufferSize) throws IOException
nicIPAddress - - if null will listen on wildcard address, which
means datagrams will be received on all local network interfaces.
Otherwise, will bind to the provided IP address associated with some NIC.port - - the port to listen onreceiveBufferSize - - the number of bytes to request for a receive
buffer from OSIOException - if unable to add channelpublic void addDatagramChannel(InetAddress nicIPAddress, int port, int receiveBufferSize, String sendingHost, Integer sendingPort) throws IOException
nicIPAddress - - if null will listen on wildcard address, which
means datagrams will be received on all local network interfaces.
Otherwise, will bind to the provided IP address associated with some NIC.port - - the port to listen on. This is used to provide a well-known
destination for a sender.receiveBufferSize - - the number of bytes to request for a receive
buffer from OSsendingHost - - the hostname, or IP address, of the sender of
datagrams. Only datagrams from this host will be received. If this is
null the wildcard ip is used, which means datagrams may be received from
any network interface on the local host.sendingPort - - the port used by the sender of datagrams. Only
datagrams from this port will be received.IOException - if unable to add channelprivate DatagramChannel createAndBindDatagramChannel(InetAddress nicIPAddress, int port, int receiveBufferSize) throws IOException
IOExceptionpublic void shutdown(long period,
TimeUnit timeUnit)
Copyright © 2023 Apache NiFi Project. All rights reserved.