|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.activemq.util.ServiceSupport
org.apache.activemq.transport.TransportSupport
org.apache.activemq.transport.TransportThreadSupport
org.apache.activemq.transport.tcp.TcpTransport
public class TcpTransport
An implementation of the Transport interface using raw tcp/ip
| Field Summary | |
|---|---|
protected TimeStampStream |
buffOut
|
protected boolean |
closeAsync
|
protected int |
connectionTimeout
|
protected DataInputStream |
dataIn
|
protected DataOutputStream |
dataOut
|
protected boolean |
diffServChosen
Prevents setting both the Differentiated Services and Type of Service transport options at the same time, since they share the same spot in the TCP/IP packet headers. |
protected boolean |
dynamicManagement
Specifies if the TransportLogger will be manageable by JMX or not. |
protected int |
ioBufferSize
|
protected int |
jmxPort
Specifies the port that will be used by the JMX server to manage the TransportLoggers. |
protected URI |
localLocation
|
protected String |
logWriterName
Name of the LogWriter implementation to use. |
protected int |
minmumWireFormatVersion
|
protected int |
receiveCounter
|
protected URI |
remoteLocation
|
protected Socket |
socket
|
protected int |
socketBufferSize
|
protected SocketFactory |
socketFactory
|
protected int |
soTimeout
|
protected boolean |
startLogging
startLogging=true -> the TransportLogger object of the Transport stack will initially write messages to the log. |
protected AtomicReference<CountDownLatch> |
stoppedLatch
|
protected boolean |
trace
trace=true -> the Transport stack where this TcpTransport object will be, will have a TransportLogger layer trace=false -> the Transport stack where this TcpTransport object will be, will NOT have a TransportLogger layer, and therefore will never be able to print logging messages. |
protected int |
trafficClass
The Traffic Class to be set on the socket. |
protected boolean |
typeOfServiceChosen
|
protected boolean |
useLocalHost
|
protected WireFormat |
wireFormat
|
| Constructor Summary | |
|---|---|
TcpTransport(WireFormat wireFormat,
Socket socket)
Initialize from a server Socket |
|
TcpTransport(WireFormat wireFormat,
SocketFactory socketFactory,
URI remoteLocation,
URI localLocation)
Connect to a remote Node - e.g. |
|
| Method Summary | ||
|---|---|---|
protected void |
closeStreams()
|
|
protected void |
connect()
|
|
protected void |
doRun()
|
|
protected void |
doStart()
|
|
protected void |
doStop(ServiceStopper stopper)
|
|
int |
getConnectionTimeout()
|
|
String |
getDiffServ()
|
|
int |
getIoBufferSize()
|
|
int |
getJmxPort()
|
|
Boolean |
getKeepAlive()
|
|
String |
getLogWriterName()
|
|
int |
getMinmumWireFormatVersion()
|
|
int |
getReceiveCounter()
Returns a counter which gets incremented as data is read from the transport. |
|
String |
getRemoteAddress()
|
|
int |
getSocketBufferSize()
|
|
int |
getSoLinger()
|
|
int |
getSoTimeout()
|
|
Boolean |
getTcpNoDelay()
|
|
int |
getTypeOfService()
|
|
WireFormat |
getWireFormat()
|
|
protected void |
initialiseSocket(Socket sock)
Configures the socket for use |
|
protected void |
initializeStreams()
|
|
boolean |
isCloseAsync()
|
|
boolean |
isDynamicManagement()
|
|
boolean |
isStartLogging()
|
|
boolean |
isTrace()
|
|
boolean |
isUseLocalHost()
|
|
|
narrow(Class<T> target)
narrow acceptance |
|
void |
oneway(Object command)
A one way asynchronous send |
|
protected Object |
readCommand()
|
|
protected String |
resolveHostName(String host)
|
|
void |
run()
reads packets from a Socket |
|
void |
setCloseAsync(boolean closeAsync)
|
|
void |
setConnectionTimeout(int connectionTimeout)
Sets the timeout used to connect to the socket |
|
void |
setDiffServ(String diffServ)
|
|
void |
setDynamicManagement(boolean useJmx)
|
|
void |
setIoBufferSize(int ioBufferSize)
|
|
void |
setJmxPort(int jmxPort)
|
|
void |
setKeepAlive(Boolean keepAlive)
Enable/disable TCP KEEP_ALIVE mode |
|
void |
setLogWriterName(String logFormat)
|
|
void |
setMinmumWireFormatVersion(int minmumWireFormatVersion)
|
|
void |
setSocketBufferSize(int socketBufferSize)
Sets the buffer size to use on the socket |
|
void |
setSocketOptions(Map<String,Object> socketOptions)
|
|
void |
setSoLinger(int soLinger)
Enable/disable soLinger |
|
void |
setSoTimeout(int soTimeout)
Sets the socket timeout |
|
void |
setStartLogging(boolean startLogging)
|
|
void |
setTcpNoDelay(Boolean tcpNoDelay)
Enable/disable the TCP_NODELAY option on the socket |
|
void |
setTrace(boolean trace)
|
|
void |
setTypeOfService(int typeOfService)
|
|
void |
setUseLocalHost(boolean useLocalHost)
Sets whether 'localhost' or the actual local host name should be used to make local connections. |
|
void |
stop()
Override so that stop() blocks until the run thread is no longer running. |
|
String |
toString()
|
|
| Methods inherited from class org.apache.activemq.transport.TransportThreadSupport |
|---|
getStackSize, isDaemon, setDaemon, setStackSize |
| Methods inherited from class org.apache.activemq.transport.TransportSupport |
|---|
asyncRequest, checkStarted, doConsume, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, onException, reconnect, request, request, setTransportListener, updateURIs |
| Methods inherited from class org.apache.activemq.util.ServiceSupport |
|---|
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.activemq.transport.Transport |
|---|
asyncRequest, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, reconnect, request, request, setTransportListener, updateURIs |
| Methods inherited from interface org.apache.activemq.Service |
|---|
start |
| Field Detail |
|---|
protected final URI remoteLocation
protected final URI localLocation
protected final WireFormat wireFormat
protected int connectionTimeout
protected int soTimeout
protected int socketBufferSize
protected int ioBufferSize
protected boolean closeAsync
protected Socket socket
protected DataOutputStream dataOut
protected DataInputStream dataIn
protected TimeStampStream buffOut
protected int trafficClass
protected boolean diffServChosen
protected boolean typeOfServiceChosen
protected boolean trace
protected String logWriterName
protected boolean dynamicManagement
protected boolean startLogging
protected int jmxPort
protected boolean useLocalHost
protected int minmumWireFormatVersion
protected SocketFactory socketFactory
protected final AtomicReference<CountDownLatch> stoppedLatch
protected volatile int receiveCounter
| Constructor Detail |
|---|
public TcpTransport(WireFormat wireFormat,
SocketFactory socketFactory,
URI remoteLocation,
URI localLocation)
throws UnknownHostException,
IOException
wireFormat - socketFactory - remoteLocation - localLocation - - e.g. local InetAddress and local port
IOException
UnknownHostException
public TcpTransport(WireFormat wireFormat,
Socket socket)
throws IOException
wireFormat - socket -
IOException| Method Detail |
|---|
public void oneway(Object command)
throws IOException
oneway in interface TransportIOExceptionpublic String toString()
toString in class Objectpublic void run()
run in interface Runnable
protected void doRun()
throws IOException
IOException
protected Object readCommand()
throws IOException
IOExceptionpublic String getDiffServ()
public void setDiffServ(String diffServ)
throws IllegalArgumentException
IllegalArgumentExceptionpublic int getTypeOfService()
public void setTypeOfService(int typeOfService)
public boolean isTrace()
public void setTrace(boolean trace)
public String getLogWriterName()
public void setLogWriterName(String logFormat)
public boolean isDynamicManagement()
public void setDynamicManagement(boolean useJmx)
public boolean isStartLogging()
public void setStartLogging(boolean startLogging)
public int getJmxPort()
public void setJmxPort(int jmxPort)
public int getMinmumWireFormatVersion()
public void setMinmumWireFormatVersion(int minmumWireFormatVersion)
public boolean isUseLocalHost()
public void setUseLocalHost(boolean useLocalHost)
public int getSocketBufferSize()
public void setSocketBufferSize(int socketBufferSize)
public int getSoTimeout()
public void setSoTimeout(int soTimeout)
public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
public Boolean getKeepAlive()
public void setKeepAlive(Boolean keepAlive)
public void setSoLinger(int soLinger)
soLinger - enabled if > -1, disabled if == -1, system default otherwisepublic int getSoLinger()
public Boolean getTcpNoDelay()
public void setTcpNoDelay(Boolean tcpNoDelay)
public int getIoBufferSize()
public void setIoBufferSize(int ioBufferSize)
ioBufferSize - the ioBufferSize to setpublic boolean isCloseAsync()
public void setCloseAsync(boolean closeAsync)
closeAsync - the closeAsync to set
protected String resolveHostName(String host)
throws UnknownHostException
UnknownHostException
protected void initialiseSocket(Socket sock)
throws SocketException,
IllegalArgumentException
sock -
SocketException, - IllegalArgumentException if setting the options
on the socket failed.
SocketException
IllegalArgumentException
protected void doStart()
throws Exception
doStart in class TransportThreadSupportException
protected void connect()
throws Exception
Exception
protected void doStop(ServiceStopper stopper)
throws Exception
doStop in class ServiceSupportException
public void stop()
throws Exception
stop in interface Servicestop in class ServiceSupportException
protected void initializeStreams()
throws Exception
Exception
protected void closeStreams()
throws IOException
IOExceptionpublic void setSocketOptions(Map<String,Object> socketOptions)
public String getRemoteAddress()
getRemoteAddress in interface Transportpublic <T> T narrow(Class<T> target)
TransportSupport
narrow in interface Transportnarrow in class TransportSupportpublic int getReceiveCounter()
Transport
getReceiveCounter in interface Transportpublic WireFormat getWireFormat()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||