public class UdpTransport extends ServiceBase implements Transport
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
UdpTransport.CANCELED |
(package private) class |
UdpTransport.CANCELING |
(package private) class |
UdpTransport.CONNECTED |
(package private) class |
UdpTransport.CONNECTING |
(package private) static class |
UdpTransport.DISCONNECTED |
(package private) static class |
UdpTransport.OneWay |
(package private) static class |
UdpTransport.SocketState |
ServiceBase.CallbackSupport, ServiceBase.STARTING, ServiceBase.State, ServiceBase.STOPPING| Modifier and Type | Field and Description |
|---|---|
static java.net.SocketAddress |
ANY_ADDRESS |
(package private) java.util.concurrent.Executor |
blockingExecutor |
private Task |
CANCEL_HANDLER |
protected java.nio.channels.DatagramChannel |
channel |
protected ProtocolCodec |
codec |
protected DispatchQueue |
dispatchQueue |
protected CustomDispatchSource<java.lang.Integer,java.lang.Integer> |
drainOutboundSource |
static int |
IPTOS_LOWCOST |
static int |
IPTOS_LOWDELAY |
static int |
IPTOS_RELIABILITY |
static int |
IPTOS_THROUGHPUT |
protected TransportListener |
listener |
(package private) java.net.SocketAddress |
localAddress |
protected java.net.URI |
localLocation |
(package private) Task |
onDispose |
private DispatchSource |
readSource |
(package private) int |
receiveBufferSize |
(package private) boolean |
rejectingOffers |
(package private) java.net.SocketAddress |
remoteAddress |
protected java.net.URI |
remoteLocation |
(package private) int |
sendBufferSize |
protected UdpTransport.SocketState |
socketState |
(package private) int |
trafficClass |
protected boolean |
useLocalHost |
(package private) boolean |
writeResumedForCodecFlush |
private DispatchSource |
writeSource |
protected CustomDispatchSource<java.lang.Integer,java.lang.Integer> |
yieldSource |
_serviceState, CREATED, STARTED, STOPPED| Constructor and Description |
|---|
UdpTransport() |
| Modifier and Type | Method and Description |
|---|---|
private void |
_resumeRead() |
void |
_start(Task onCompleted) |
void |
_stop(Task onCompleted) |
private boolean |
assertConnected() |
void |
connected(java.nio.channels.DatagramChannel channel) |
void |
connecting(java.net.URI remoteLocation,
java.net.URI localLocation) |
private void |
dispose() |
void |
drainInbound() |
void |
flush()
Forces a flush of any output buffers.
|
boolean |
full() |
java.util.concurrent.Executor |
getBlockingExecutor() |
java.nio.channels.DatagramChannel |
getDatagramChannel() |
DispatchQueue |
getDispatchQueue()
Returns the dispatch queue used by the transport
|
java.net.SocketAddress |
getLocalAddress() |
ProtocolCodec |
getProtocolCodec() |
java.nio.channels.ReadableByteChannel |
getReadChannel() |
int |
getReceiveBufferSize() |
java.net.SocketAddress |
getRemoteAddress() |
int |
getSendBufferSize() |
int |
getTrafficClass() |
TransportListener |
getTransportListener()
Returns the current transport listener
|
java.nio.channels.WritableByteChannel |
getWriteChannel() |
protected void |
initializeChannel() |
protected void |
initializeCodec() |
boolean |
isClosed() |
boolean |
isConnected() |
boolean |
isUseLocalHost() |
boolean |
offer(java.lang.Object command)
A one way asynchronous send of a command.
|
protected void |
onConnected() |
void |
onTransportFailure(java.io.IOException error) |
protected java.lang.String |
resolveHostName(java.lang.String host) |
void |
resumeRead()
resume delivery of commands.
|
protected void |
resumeWrite() |
void |
setBlockingExecutor(java.util.concurrent.Executor blockingExecutor) |
void |
setDispatchQueue(DispatchQueue queue)
Sets the dispatch queue used by the transport
|
void |
setProtocolCodec(ProtocolCodec protocolCodec)
Sets the protocol codec for the transport
|
void |
setReceiveBufferSize(int receiveBufferSize) |
void |
setSendBufferSize(int sendBufferSize) |
void |
setTrafficClass(int trafficClass) |
void |
setTransportListener(TransportListener transportListener)
Registers an inbound command listener
|
void |
setUseLocalHost(boolean useLocalHost)
Sets whether 'localhost' or the actual local host name should be used to
make local connections.
|
void |
suspendRead()
suspend delivery of commands.
|
protected void |
suspendWrite() |
private void |
trace(java.lang.String message) |
protected boolean |
transportFlush() |
getServiceState, start, start, stop, stoppublic static final java.net.SocketAddress ANY_ADDRESS
protected java.net.URI remoteLocation
protected java.net.URI localLocation
protected TransportListener listener
protected ProtocolCodec codec
protected java.nio.channels.DatagramChannel channel
protected UdpTransport.SocketState socketState
protected DispatchQueue dispatchQueue
private DispatchSource readSource
private DispatchSource writeSource
protected CustomDispatchSource<java.lang.Integer,java.lang.Integer> drainOutboundSource
protected CustomDispatchSource<java.lang.Integer,java.lang.Integer> yieldSource
protected boolean useLocalHost
int receiveBufferSize
int sendBufferSize
public static final int IPTOS_LOWCOST
public static final int IPTOS_RELIABILITY
public static final int IPTOS_THROUGHPUT
public static final int IPTOS_LOWDELAY
int trafficClass
java.net.SocketAddress localAddress
java.net.SocketAddress remoteAddress
java.util.concurrent.Executor blockingExecutor
private final Task CANCEL_HANDLER
Task onDispose
boolean rejectingOffers
boolean writeResumedForCodecFlush
public void connected(java.nio.channels.DatagramChannel channel)
throws java.io.IOException,
java.lang.Exception
java.io.IOExceptionjava.lang.Exceptionprotected void initializeChannel()
throws java.lang.Exception
java.lang.Exceptionprotected void initializeCodec()
throws java.lang.Exception
java.lang.Exceptionpublic void connecting(java.net.URI remoteLocation,
java.net.URI localLocation)
throws java.lang.Exception
java.lang.Exceptionpublic DispatchQueue getDispatchQueue()
TransportgetDispatchQueue in interface TransportgetDispatchQueue in class ServiceBasepublic void setDispatchQueue(DispatchQueue queue)
TransportsetDispatchQueue in interface Transportpublic void _start(Task onCompleted)
_start in class ServiceBasepublic void _stop(Task onCompleted)
_stop in class ServiceBaseprotected java.lang.String resolveHostName(java.lang.String host)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionprotected void onConnected()
throws java.io.IOException
java.io.IOExceptionprivate void dispose()
public void onTransportFailure(java.io.IOException error)
public boolean offer(java.lang.Object command)
Transportpublic void flush()
Transportprotected boolean transportFlush()
throws java.io.IOException
java.io.IOExceptionpublic void drainInbound()
drainInbound in interface Transportpublic java.net.SocketAddress getLocalAddress()
getLocalAddress in interface Transportpublic java.net.SocketAddress getRemoteAddress()
getRemoteAddress in interface Transportprivate boolean assertConnected()
public void suspendRead()
TransportsuspendRead in interface Transportpublic void resumeRead()
TransportresumeRead in interface Transportprivate void _resumeRead()
protected void suspendWrite()
protected void resumeWrite()
public TransportListener getTransportListener()
TransportgetTransportListener in interface Transportpublic void setTransportListener(TransportListener transportListener)
TransportsetTransportListener in interface Transportpublic ProtocolCodec getProtocolCodec()
getProtocolCodec in interface Transportpublic void setProtocolCodec(ProtocolCodec protocolCodec) throws java.lang.Exception
TransportsetProtocolCodec in interface Transportjava.lang.Exceptionpublic boolean isConnected()
isConnected in interface Transportpublic boolean isClosed()
public boolean isUseLocalHost()
public void setUseLocalHost(boolean useLocalHost)
private void trace(java.lang.String message)
public java.nio.channels.DatagramChannel getDatagramChannel()
public java.nio.channels.ReadableByteChannel getReadChannel()
getReadChannel in interface Transportpublic java.nio.channels.WritableByteChannel getWriteChannel()
getWriteChannel in interface Transportpublic int getTrafficClass()
public void setTrafficClass(int trafficClass)
public int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveBufferSize)
public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
public java.util.concurrent.Executor getBlockingExecutor()
getBlockingExecutor in interface Transportpublic void setBlockingExecutor(java.util.concurrent.Executor blockingExecutor)
setBlockingExecutor in interface Transport