public class UDPNIOConnection extends NIOConnection
Connection implementation for the UDPNIOTransportConnection.CloseListener, Connection.CloseTypeattributes, channel, connectCloseSemaphoreUpdater, isBlocking, isStandalone, maxAsyncWriteQueueSize, monitoringConfig, NOTIFICATION_CLOSED_COMPLETE, NOTIFICATION_INITIALIZED, processor, processorSelector, readTimeoutMillis, selectionKey, selectorRunner, transport, writeTimeoutMillis, zeroByteReadCount| Constructor and Description |
|---|
UDPNIOConnection(UDPNIOTransport transport,
DatagramChannel channel) |
| Modifier and Type | Method and Description |
|---|---|
void |
block(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Blocks multicast datagrams from the given source address.
|
boolean |
canWrite() |
boolean |
canWrite(int length)
Deprecated.
|
void |
drop(InetAddress group,
NetworkInterface networkInterface)
Drops non-source specific membership in a multicast group.
|
void |
drop(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Drops membership in a multicast group.
|
void |
dropAll(InetAddress group,
NetworkInterface networkInterface)
Drops all active membership in a multicast group.
|
protected void |
enableInitialOpRead()
Enables OP_READ if it has never been enabled before.
|
SocketAddress |
getLocalAddress()
Returns the local address of this Connection, or null if it is unconnected.
|
SocketAddress |
getPeerAddress()
Returns the address of the endpoint this Connection is connected to, or null if it is unconnected.
|
int |
getReadBufferSize()
Get the default size of
Buffers, which will be allocated for reading data from Connection. |
int |
getWriteBufferSize()
Get the default size of
Buffers, which will be allocated for writing data to Connection. |
boolean |
isConnected() |
void |
join(InetAddress group,
NetworkInterface networkInterface)
Joins a multicast group to begin receiving all datagrams sent to the group.
|
void |
join(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Joins a multicast group to begin receiving datagrams sent to the group from a given source address.
|
void |
notifyCanWrite(WriteHandler writeHandler)
Instructs the
OutputSink to invoke the provided WriteHandler when it is possible to write more
bytes (or characters). |
void |
notifyCanWrite(WriteHandler handler,
int length)
Deprecated.
|
protected boolean |
notifyReady() |
protected void |
onConnect()
Method will be called, when the connection gets connected.
|
protected void |
onRead(Buffer data,
int size)
Method will be called, when some data was read on the connection
|
protected void |
onWrite(Buffer data,
int size)
Method will be called, when some data was written on the connection
|
protected void |
resetProperties() |
void |
setReadBufferSize(int readBufferSize)
Set the default size of
Buffers, which will be allocated for reading data from Connection. |
protected void |
setSelectionKey(SelectionKey selectionKey) |
protected void |
setSelectorRunner(SelectorRunner selectorRunner) |
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of
Buffers, which will be allocated for writing data to Connection. |
String |
toString() |
void |
unblock(InetAddress group,
NetworkInterface networkInterface,
InetAddress source)
Unblocks multicast datagrams from the given source address.
|
addCloseListener, addCloseListener, assertOpen, attachToSelectorRunner, checkEmptyRead, close, close, closeFuture, closeGracefully0, closeSilently, closeWithReason, configureBlocking, configureStandalone, detachSelectorRunner, disableIOEvent, doClose, enableIOEvent, executeInEventThread, getAsyncReadQueue, getAsyncWriteQueue, getAttributes, getChannel, getCloseReason, getMaxAsyncWriteQueueSize, getMemoryManager, getMonitoringConfig, getProcessor, getProcessorSelector, getReadTimeout, getSelectionKey, getSelectorRunner, getTransport, getWriteTimeout, isBlocking, isClosed, isOpen, isStandalone, notifyConnectionError, notifyIOEventDisabled, notifyIOEventEnabled, notifyIOEventReady, notifyProbesAccept, notifyProbesBind, notifyProbesClose, notifyProbesConnect, notifyProbesError, notifyProbesRead, notifyProbesWrite, obtainProcessor, obtainProcessorState, preClose, read, read, removeCloseListener, removeCloseListener, setChannel, setMaxAsyncWriteQueueSize, setProcessor, setProcessorSelector, setReadTimeout, setWriteTimeout, simulateIOEvent, terminate, terminate0, terminateSilently, terminateWithReason, write, write, write, write, writepublic UDPNIOConnection(UDPNIOTransport transport, DatagramChannel channel)
public boolean isConnected()
public void join(InetAddress group, NetworkInterface networkInterface) throws IOException
group - The multicast address to joinnetworkInterface - The network interface on which to join the groupIOExceptionpublic void join(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
group - The multicast address to joinnetworkInterface - The network interface on which to join the groupsource - The source addressIOExceptionpublic void drop(InetAddress group, NetworkInterface networkInterface) throws IOException
group - The multicast address to joinnetworkInterface - The network interface on which to join the groupIOExceptionpublic void drop(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
drop(java.net.InetAddress, java.net.NetworkInterface).
If the source parameter is not null and this connection doesn't have source specific membership in the group on the
given interface to receive datagrams then this method call has no effect. Otherwise this connection drops the source
specific group membership.group - The multicast address to joinnetworkInterface - The network interface on which to join the groupsource - The source addressIOExceptionpublic void dropAll(InetAddress group, NetworkInterface networkInterface) throws IOException
group - The multicast address to joinnetworkInterface - The network interface on which to join the groupIOExceptionpublic void block(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
group - The multicast address to joinnetworkInterface - The network interface on which to join the groupsource - The source address to blockIOExceptionpublic void unblock(InetAddress group, NetworkInterface networkInterface, InetAddress source) throws IOException
block(java.net.InetAddress, java.net.NetworkInterface, java.net.InetAddress) method then this method
unblocks multicast datagrams from the given source address. If the given source address wasn't blocked then this
method has no effect.group - The multicast address to joinnetworkInterface - The network interface on which to join the groupsource - The source address to blockIOExceptionprotected void setSelectionKey(SelectionKey selectionKey)
setSelectionKey in class NIOConnectionprotected void setSelectorRunner(SelectorRunner selectorRunner)
setSelectorRunner in class NIOConnectionprotected boolean notifyReady()
public SocketAddress getPeerAddress()
public SocketAddress getLocalAddress()
protected final void resetProperties()
public int getReadBufferSize()
Buffers, which will be allocated for reading data from Connection. The value
less or equal to zero will be ignored.Buffers, which will be allocated for reading data from Connection.public void setReadBufferSize(int readBufferSize)
Buffers, which will be allocated for reading data from Connection. The value
less or equal to zero will be ignored.readBufferSize - the default size of Buffers, which will be allocated for reading data from
Connection.public int getWriteBufferSize()
Buffers, which will be allocated for writing data to Connection.Buffers, which will be allocated for writing data to Connection.public void setWriteBufferSize(int writeBufferSize)
Buffers, which will be allocated for writing data to Connection.writeBufferSize - the default size of Buffers, which will be allocated for writing data to
Connection.protected void enableInitialOpRead()
throws IOException
NIOConnectionenableInitialOpRead in class NIOConnectionIOExceptionprotected final void onConnect()
throws IOException
IOExceptionprotected final void onRead(Buffer data, int size)
protected final void onWrite(Buffer data, int size)
public boolean canWrite()
true if a write to this OutputSink will succeed, otherwise returns
false.@Deprecated public boolean canWrite(int length)
length - specifies the number of bytes (or characters) that require writingtrue if a write to this OutputSink will succeed, otherwise returns
false.public void notifyCanWrite(WriteHandler writeHandler)
OutputSink to invoke the provided WriteHandler when it is possible to write more
bytes (or characters).
Note that once the WriteHandler has been notified, it will not be considered for notification again at a
later point in time.writeHandler - the WriteHandler that should be notified when it's possible to write more data.@Deprecated public void notifyCanWrite(WriteHandler handler, int length)
OutputSink to invoke the provided WriteHandler when it is possible to write
length bytes (or characters).
Note that once the WriteHandler has been notified, it will not be considered for notification again at a
later point in time.handler - the WriteHandler that should be notified when it's possible to write length
bytes.length - the number of bytes or characters that require writing.Copyright © 2017–2020 Oracle Corporation. All rights reserved.