|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fusesource.hawtdispatch.transport.TcpTransport
public class TcpTransport
An implementation of the Transport interface using raw tcp/ip
| Nested Class Summary | |
|---|---|
static class |
ServiceBase.STARTING
|
static class |
ServiceBase.State
|
static class |
ServiceBase.STOPPING
|
| Field Summary | |
|---|---|
protected ServiceBase.State |
_serviceState
|
protected SocketChannel |
channel
|
protected ProtocolCodec |
codec
|
static ServiceBase.State |
CREATED
|
protected DispatchQueue |
dispatchQueue
|
protected CustomDispatchSource<Integer,Integer> |
drainOutboundSource
|
static int |
IPTOS_LOWCOST
|
static int |
IPTOS_LOWDELAY
|
static int |
IPTOS_RELIABILITY
|
static int |
IPTOS_THROUGHPUT
|
protected TransportListener |
listener
|
protected URI |
localLocation
|
protected org.fusesource.hawtdispatch.transport.TcpTransport.RateLimitingChannel |
rateLimitingChannel
|
protected URI |
remoteLocation
|
protected org.fusesource.hawtdispatch.transport.TcpTransport.SocketState |
socketState
|
static ServiceBase.State |
STARTED
|
static ServiceBase.State |
STOPPED
|
protected boolean |
useLocalHost
|
protected CustomDispatchSource<Integer,Integer> |
yieldSource
|
| Constructor Summary | |
|---|---|
TcpTransport()
|
|
| Method Summary | ||
|---|---|---|
void |
_start(Runnable onCompleted)
|
|
void |
_stop(Runnable onCompleted)
|
|
void |
connected(SocketChannel channel)
|
|
void |
connecting(URI remoteLocation,
URI localLocation)
|
|
protected void |
drainInbound()
|
|
void |
flush()
Forces a flush of any output buffers. |
|
boolean |
full()
|
|
DispatchQueue |
getDispatchQueue()
Returns the dispatch queue used by the transport |
|
SocketAddress |
getLocalAddress()
|
|
int |
getMaxReadRate()
|
|
int |
getMaxWriteRate()
|
|
ProtocolCodec |
getProtocolCodec()
|
|
int |
getReceiveBufferSize()
|
|
SocketAddress |
getRemoteAddress()
|
|
int |
getSendBufferSize()
|
|
protected ServiceBase.State |
getServiceState()
|
|
SocketChannel |
getSocketChannel()
|
|
int |
getTrafficClass()
|
|
TransportListener |
getTransportListener()
Returns the current transport listener |
|
String |
getTypeId()
|
|
protected void |
initializeChannel()
|
|
protected void |
initializeCodec()
|
|
boolean |
isConnected()
|
|
boolean |
isDisposed()
|
|
boolean |
isFaultTolerant()
Indicates if the transport can handle faults |
|
boolean |
isKeepAlive()
|
|
boolean |
isUseLocalHost()
|
|
|
narrow(Class<T> target)
|
|
boolean |
offer(Object command)
A one way asynchronous send of a command. |
|
protected void |
onConnected()
|
|
void |
onTransportFailure(IOException error)
|
|
ReadableByteChannel |
readChannel()
|
|
void |
reconnect(URI uri)
reconnect to another location |
|
protected String |
resolveHostName(String host)
|
|
void |
resumeRead()
resume delivery of commands. |
|
protected void |
resumeWrite()
|
|
void |
setDispatchQueue(DispatchQueue queue)
Sets the dispatch queue used by the transport |
|
void |
setKeepAlive(boolean keepAlive)
|
|
void |
setMaxReadRate(int maxReadRate)
|
|
void |
setMaxWriteRate(int maxWriteRate)
|
|
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 listener)
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 |
start(Runnable onCompleted)
|
|
void |
stop(Runnable onCompleted)
|
|
void |
suspendRead()
suspend delivery of commands. |
|
protected void |
suspendWrite()
|
|
protected boolean |
transportFlush()
|
|
WritableByteChannel |
writeChannel()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.fusesource.hawtdispatch.transport.Transport |
|---|
start, stop |
| Field Detail |
|---|
protected URI remoteLocation
protected URI localLocation
protected TransportListener listener
protected ProtocolCodec codec
protected SocketChannel channel
protected org.fusesource.hawtdispatch.transport.TcpTransport.SocketState socketState
protected DispatchQueue dispatchQueue
protected CustomDispatchSource<Integer,Integer> drainOutboundSource
protected CustomDispatchSource<Integer,Integer> yieldSource
protected boolean useLocalHost
public static final int IPTOS_LOWCOST
public static final int IPTOS_RELIABILITY
public static final int IPTOS_THROUGHPUT
public static final int IPTOS_LOWDELAY
protected org.fusesource.hawtdispatch.transport.TcpTransport.RateLimitingChannel rateLimitingChannel
public static final ServiceBase.State CREATED
public static final ServiceBase.State STARTED
public static final ServiceBase.State STOPPED
protected ServiceBase.State _serviceState
| Constructor Detail |
|---|
public TcpTransport()
| Method Detail |
|---|
public void connected(SocketChannel channel)
throws IOException,
Exception
IOException
Exception
protected void initializeChannel()
throws Exception
Exception
protected void initializeCodec()
throws Exception
Exception
public void connecting(URI remoteLocation,
URI localLocation)
throws IOException,
Exception
IOException
Exceptionpublic DispatchQueue getDispatchQueue()
Transport
getDispatchQueue in interface Transportpublic void setDispatchQueue(DispatchQueue queue)
Transport
setDispatchQueue in interface Transportpublic void _start(Runnable onCompleted)
public void _stop(Runnable onCompleted)
protected String resolveHostName(String host)
throws UnknownHostException
UnknownHostException
protected void onConnected()
throws IOException
IOExceptionpublic void onTransportFailure(IOException error)
public boolean full()
full in interface Transportpublic boolean offer(Object command)
Transport
offer in interface Transportpublic void flush()
Transport
flush in interface Transport
protected boolean transportFlush()
throws IOException
IOExceptionprotected void drainInbound()
public SocketAddress getLocalAddress()
getLocalAddress in interface Transportpublic SocketAddress getRemoteAddress()
getRemoteAddress in interface Transportpublic <T> T narrow(Class<T> target)
narrow in interface Transportpublic void suspendRead()
Transport
suspendRead in interface Transportpublic void resumeRead()
Transport
resumeRead in interface Transportprotected void suspendWrite()
protected void resumeWrite()
public String getTypeId()
getTypeId in interface Transportpublic void reconnect(URI uri)
Transport
reconnect in interface Transportpublic TransportListener getTransportListener()
Transport
getTransportListener in interface Transportpublic void setTransportListener(TransportListener listener)
Transport
setTransportListener in interface Transportpublic ProtocolCodec getProtocolCodec()
getProtocolCodec in interface Transport
public void setProtocolCodec(ProtocolCodec protocolCodec)
throws Exception
Transport
setProtocolCodec in interface TransportExceptionpublic boolean isConnected()
isConnected in interface Transportpublic boolean isDisposed()
isDisposed in interface Transportpublic boolean isFaultTolerant()
Transport
isFaultTolerant in interface Transportpublic boolean isUseLocalHost()
public void setUseLocalHost(boolean useLocalHost)
public SocketChannel getSocketChannel()
public ReadableByteChannel readChannel()
public WritableByteChannel writeChannel()
public int getMaxReadRate()
public void setMaxReadRate(int maxReadRate)
public int getMaxWriteRate()
public void setMaxWriteRate(int maxWriteRate)
public int getTrafficClass()
public void setTrafficClass(int trafficClass)
public int getReceiveBufferSize()
public void setReceiveBufferSize(int receiveBufferSize)
public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
public boolean isKeepAlive()
public void setKeepAlive(boolean keepAlive)
public final void start(Runnable onCompleted)
public final void stop(Runnable onCompleted)
protected ServiceBase.State getServiceState()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||