Package com.tangosol.net
Class NonBlockingTcpDatagramSocket
java.lang.Object
java.net.DatagramSocket
com.tangosol.net.TcpDatagramSocket
com.tangosol.net.NonBlockingTcpDatagramSocket
- All Implemented Interfaces:
Closeable
,AutoCloseable
TCP based non-blocking datagram socket implementation.
In order to provide a non-blocking API this implementation may drop packets
if the underlying TCP transfer buffers are full.
- Author:
- mf 2009.12.16
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A specialization ofTcpDatagramSocket.Impl
which provides non-blocking functionality, seeNonBlockingTcpDatagramSocket.Impl.send(DatagramPacket)
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
Flag indicating if split sockets should be used for TcpDatagram sockets.Fields inherited from class com.tangosol.net.TcpDatagramSocket
IO_EXCEPTIONS_LOG_LEVEL, m_impl
-
Constructor Summary
ModifierConstructorDescriptionCreate a new NonBlockingTcpDatagramSocket that with a wildcard address bound to an ephemeral port.NonBlockingTcpDatagramSocket
(int nPort) Creates a new NonBlockingTcpDatagramSocket using the wildcard address and the specified port number.NonBlockingTcpDatagramSocket
(int nPort, InetAddress addr) Creates a new NonBlockingTcpDatagramSocket using anaddress
and a port number.NonBlockingTcpDatagramSocket
(com.oracle.coherence.common.net.SocketProvider provider) Creates a new NonBlockingTcpDatagramSocket using theprovider
.protected
Creates a new NonBlockingTcpDatagramSocket around anNonBlockingTcpDatagramSocket.Impl
.Creates a new NonBlockingTcpDatagramSocket which will be bound to the specifiedaddress
. -
Method Summary
Methods inherited from class com.tangosol.net.TcpDatagramSocket
isBound, receive, send, setAdvanceFrequency, setListenBacklog, setPacketMagic, setSocketOptions, toString
Methods inherited from class java.net.DatagramSocket
bind, close, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isClosed, isConnected, joinGroup, leaveGroup, setBroadcast, setDatagramSocketImplFactory, setOption, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass, supportedOptions
-
Field Details
-
SPLIT
public static final boolean SPLITFlag indicating if split sockets should be used for TcpDatagram sockets. While this should ideally never be needed, testing on Linux has shown that under heavy packet loads the socket can appear to stall and refuse to accept or emit data. Worse still while the socket is in this state the NIC is transmitting ~300,000 packets/second, even when the process is paused CTRL+Z'd. This setting is conceptually similar to the "coherence.datagram.splitsocket" but only applies to TcpDatagram sockets. Additionally it does not require multiple listening ports, just multiple connections. As of 3.6.1 this value defaults to false. This became "safe" in 3.6.1 since this version began using multiple listening sockets, and avoids the case which would be likely to trigger the Linux stall issue.
-
-
Constructor Details
-
NonBlockingTcpDatagramSocket
Create a new NonBlockingTcpDatagramSocket that with a wildcard address bound to an ephemeral port.- Throws:
SocketException
- if any error happens during the bind, or if the port is unavailable
-
NonBlockingTcpDatagramSocket
Creates a new NonBlockingTcpDatagramSocket which will be bound to the specifiedaddress
.- Parameters:
addr
- theaddress
to bind- Throws:
SocketException
- if any error happens during the bind, or if the port is unavailable
-
NonBlockingTcpDatagramSocket
Creates a new NonBlockingTcpDatagramSocket using the wildcard address and the specified port number.The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.
- Parameters:
nPort
- the port to bind to- Throws:
SocketException
- if any error happens during the bind, or if the port is unavailable
-
NonBlockingTcpDatagramSocket
Creates a new NonBlockingTcpDatagramSocket using anaddress
and a port number.If
null
is specified as the address assigned will be the wildcard address.The port number should be between 0 and 65535. Zero means that the system will pick an ephemeral port during the bind operation.
- Parameters:
nPort
- the port numberaddr
- the IP address- Throws:
SocketException
- if any error happens during the bind, or if the port is unavailable
-
NonBlockingTcpDatagramSocket
public NonBlockingTcpDatagramSocket(com.oracle.coherence.common.net.SocketProvider provider) throws SocketException Creates a new NonBlockingTcpDatagramSocket using theprovider
.- Parameters:
provider
- theprovider
to be used- Throws:
SocketException
- if any error happens during the bind, or if the port is unavailable
-
NonBlockingTcpDatagramSocket
Creates a new NonBlockingTcpDatagramSocket around anNonBlockingTcpDatagramSocket.Impl
.- Parameters:
impl
- aNonBlockingTcpDatagramSocket.Impl
-