|
||||||||||
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 TcpBufferedOutputStream |
buffOut
|
protected boolean |
closeAsync
|
protected int |
connectionTimeout
|
protected DataInputStream |
dataIn
|
protected DataOutputStream |
dataOut
|
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 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 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()
|
|
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 |
getSoTimeout()
|
|
Boolean |
getTcpNoDelay()
|
|
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 |
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 |
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 |
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, onException, reconnect, request, request, setTransportListener |
Methods inherited from class org.apache.activemq.util.ServiceSupport |
---|
addServiceListener, dispose, isStarted, isStopped, isStopping, 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, reconnect, request, request, setTransportListener |
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 TcpBufferedOutputStream buffOut
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
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 Transport
IOException
public String toString()
toString
in class Object
public void run()
run
in interface Runnable
protected void doRun() throws IOException
IOException
protected Object readCommand() throws IOException
IOException
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 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 setprotected String resolveHostName(String host) throws UnknownHostException
UnknownHostException
protected void initialiseSocket(Socket sock) throws SocketException
sock
-
SocketException
protected void doStart() throws Exception
doStart
in class TransportThreadSupport
Exception
protected void connect() throws Exception
Exception
protected void doStop(ServiceStopper stopper) throws Exception
doStop
in class ServiceSupport
Exception
public void stop() throws Exception
stop
in interface Service
stop
in class ServiceSupport
Exception
protected void initializeStreams() throws Exception
Exception
protected void closeStreams() throws IOException
IOException
public void setSocketOptions(Map<String,Object> socketOptions)
public String getRemoteAddress()
getRemoteAddress
in interface Transport
public <T> T narrow(Class<T> target)
TransportSupport
narrow
in interface Transport
narrow
in class TransportSupport
public int getReceiveCounter()
Transport
getReceiveCounter
in interface Transport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |