public class TcpTransportServer extends Object implements TransportServer
TransportServer| Modifier and Type | Field and Description |
|---|---|
protected DispatchSource |
acceptSource |
protected int |
backlog |
protected InetSocketAddress |
bindAddress |
protected String |
bindScheme |
protected Executor |
blockingExecutor |
protected ServerSocketChannel |
channel |
protected DispatchQueue |
dispatchQueue |
protected TransportServerListener |
listener |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
| Constructor and Description |
|---|
TcpTransportServer(URI location) |
| Modifier and Type | Method and Description |
|---|---|
protected TcpTransport |
createTransport() |
int |
getBacklog() |
Executor |
getBlockingExecutor() |
String |
getBoundAddress() |
DispatchQueue |
getDispatchQueue()
Returns the dispatch queue used by the transport
|
int |
getReceiveBufferSize() |
int |
getSendBufferSize() |
InetSocketAddress |
getSocketAddress() |
protected void |
handleSocket(SocketChannel socket) |
void |
resume()
resume accepting new transports
|
void |
setBacklog(int backlog) |
void |
setBlockingExecutor(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(Runnable onCompleted)
Deprecated.
|
void |
start(Task onCompleted)
Starts the service.
|
void |
stop(Runnable onCompleted)
Deprecated.
|
void |
stop(Task onCompleted)
Stops the service.
|
void |
suspend()
suspend accepting new transports
|
String |
toString() |
protected final String bindScheme
protected final InetSocketAddress bindAddress
protected int backlog
protected ServerSocketChannel channel
protected TransportServerListener listener
protected DispatchQueue dispatchQueue
protected DispatchSource acceptSource
protected int receiveBufferSize
protected int sendBufferSize
protected Executor blockingExecutor
public TcpTransportServer(URI location) throws UnknownHostException
UnknownHostExceptionpublic void setTransportServerListener(TransportServerListener listener)
TransportServerTransportAcceptListener which is notified of accepted
channels.setTransportServerListener in interface TransportServerpublic 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(Runnable onCompleted) throws Exception
start in interface TransportServerException@Deprecated public void stop(Runnable onCompleted) throws Exception
stop in interface TransportServerExceptionpublic void start(Task onCompleted) throws Exception
TransportServerstart in interface TransportServeronCompleted - my be set to null if not interested in a callback.Exceptionpublic String getBoundAddress()
getBoundAddress in interface TransportServerpublic void stop(Task onCompleted) throws Exception
TransportServerstop in interface TransportServeronCompleted - my be set to null if not interested in a callback.Exceptionpublic int getBacklog()
public void setBacklog(int backlog)
protected final void handleSocket(SocketChannel socket) throws Exception
Exceptionprotected TcpTransport createTransport()
public int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveBufferSize)
public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
public Executor getBlockingExecutor()
getBlockingExecutor in interface TransportServerpublic void setBlockingExecutor(Executor blockingExecutor)
setBlockingExecutor in interface TransportServerCopyright © 2010-2013 FuseSource, Corp.. All Rights Reserved.