public class TcpTransportServer extends java.lang.Object implements TransportServer
TransportServer| Modifier and Type | Field and Description |
|---|---|
protected DispatchSource |
acceptSource |
protected int |
backlog |
protected java.net.InetSocketAddress |
bindAddress |
protected java.lang.String |
bindScheme |
protected java.util.concurrent.Executor |
blockingExecutor |
protected java.nio.channels.ServerSocketChannel |
channel |
protected DispatchQueue |
dispatchQueue |
protected TransportServerListener |
listener |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
| Constructor and Description |
|---|
TcpTransportServer(java.net.URI location) |
| Modifier and Type | Method and Description |
|---|---|
protected TcpTransport |
createTransport() |
int |
getBacklog() |
java.util.concurrent.Executor |
getBlockingExecutor() |
java.lang.String |
getBoundAddress() |
DispatchQueue |
getDispatchQueue()
Returns the dispatch queue used by the transport
|
int |
getReceiveBufferSize() |
int |
getSendBufferSize() |
java.net.InetSocketAddress |
getSocketAddress() |
protected void |
handleSocket(java.nio.channels.SocketChannel socket) |
void |
resume()
resume accepting new transports
|
void |
setBacklog(int backlog) |
void |
setBlockingExecutor(java.util.concurrent.Executor blockingExecutor) |
void |
setDispatchQueue(DispatchQueue dispatchQueue)
Sets the dispatch queue used by the transport
|
void |
setReceiveBufferSize(int receiveBufferSize) |
void |
setSendBufferSize(int sendBufferSize) |
void |
setTransportServerListener(TransportServerListener listener)
Registers an
TransportAcceptListener which is notified of accepted
channels. |
void |
start(java.lang.Runnable onCompleted)
Deprecated.
|
void |
start(Task onCompleted)
Starts the service.
|
void |
stop(java.lang.Runnable onCompleted)
Deprecated.
|
void |
stop(Task onCompleted)
Stops the service.
|
void |
suspend()
suspend accepting new transports
|
java.lang.String |
toString() |
protected final java.lang.String bindScheme
protected final java.net.InetSocketAddress bindAddress
protected int backlog
protected java.nio.channels.ServerSocketChannel channel
protected TransportServerListener listener
protected DispatchQueue dispatchQueue
protected DispatchSource acceptSource
protected int receiveBufferSize
protected int sendBufferSize
protected java.util.concurrent.Executor blockingExecutor
public TcpTransportServer(java.net.URI location)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic void setTransportServerListener(TransportServerListener listener)
TransportServerTransportAcceptListener which is notified of accepted
channels.setTransportServerListener in interface TransportServerpublic java.net.InetSocketAddress getSocketAddress()
getSocketAddress in interface TransportServerpublic DispatchQueue getDispatchQueue()
TransportServergetDispatchQueue in interface TransportServerpublic void setDispatchQueue(DispatchQueue dispatchQueue)
TransportServersetDispatchQueue in interface TransportServerpublic void suspend()
TransportServersuspend in interface TransportServerpublic void resume()
TransportServerresume in interface TransportServer@Deprecated
public void start(java.lang.Runnable onCompleted)
throws java.lang.Exception
start in interface TransportServerjava.lang.Exception@Deprecated
public void stop(java.lang.Runnable onCompleted)
throws java.lang.Exception
stop in interface TransportServerjava.lang.Exceptionpublic void start(Task onCompleted) throws java.lang.Exception
TransportServerstart in interface TransportServeronCompleted - my be set to null if not interested in a callback.java.lang.Exceptionpublic java.lang.String getBoundAddress()
getBoundAddress in interface TransportServerpublic void stop(Task onCompleted) throws java.lang.Exception
TransportServerstop in interface TransportServeronCompleted - my be set to null if not interested in a callback.java.lang.Exceptionpublic int getBacklog()
public void setBacklog(int backlog)
protected final void handleSocket(java.nio.channels.SocketChannel socket)
throws java.lang.Exception
java.lang.Exceptionprotected TcpTransport createTransport()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveBufferSize)
public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
public java.util.concurrent.Executor getBlockingExecutor()
getBlockingExecutor in interface TransportServerpublic void setBlockingExecutor(java.util.concurrent.Executor blockingExecutor)
setBlockingExecutor in interface TransportServer