Class ReliableTcpClient
- java.lang.Object
-
- org.objectweb.joram.client.jms.tcp.ReliableTcpClient
-
- Direct Known Subclasses:
ReliableSSLTcpClient
public class ReliableTcpClient extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classReliableTcpClient.ServerAddress
-
Field Summary
Fields Modifier and Type Field Description private Vector<ReliableTcpClient.ServerAddress>addressesstatic StringCLOCK_SYNCHRO_THRESHOLDName of the property allowing to change the threshold of warning for the verification of the synchronization between the client and server clock.private longclockSynchroThresholdValue of the threshold of warning for the verification of the synchronization between the client and server clock.static intCLOSEstatic intCONNECTprivate ReliableTcpConnectionconnectionprotected org.objectweb.joram.shared.security.Identityidentitystatic intINITprotected intkeyprivate static org.objectweb.util.monolog.api.Loggerloggerprotected FactoryParametersparamsprivate booleanreconnectTrue if the client must try to reconnect in case of connection failure.private intreconnectTimeoutTime in ms during the client try to reconnect to the server.private intstatusprotected static String[]statusNamesprivate Timertimer
-
Constructor Summary
Constructors Constructor Description ReliableTcpClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddServerAddress(String host, int port)voidclose()voidconnect()voidconnect(boolean reconnect)protected SocketcreateSocket(String hostname, int port)private voiddoConnect(String hostname, int port)voidinit(FactoryParameters params, org.objectweb.joram.shared.security.Identity identity, boolean reconnect)Objectreceive()private voidreconnect()voidsend(org.objectweb.joram.shared.client.AbstractJmsMessage request)private voidsetStatus(int status)voidsetTimer(Timer timer)voidstopReconnections()private voidthrowSecurityError(String info)StringtoString()private voidwaitForReconnection()
-
-
-
Field Detail
-
logger
private static final org.objectweb.util.monolog.api.Logger logger
-
INIT
public static final int INIT
- See Also:
- Constant Field Values
-
CONNECT
public static final int CONNECT
- See Also:
- Constant Field Values
-
CLOSE
public static final int CLOSE
- See Also:
- Constant Field Values
-
statusNames
protected static final String[] statusNames
-
params
protected FactoryParameters params
-
identity
protected org.objectweb.joram.shared.security.Identity identity
-
key
protected int key
-
connection
private ReliableTcpConnection connection
-
status
private volatile int status
-
addresses
private Vector<ReliableTcpClient.ServerAddress> addresses
-
reconnect
private boolean reconnect
True if the client must try to reconnect in case of connection failure. It depends of cnxPendingTimer on a "normal" TCP connection.
-
reconnectTimeout
private int reconnectTimeout
Time in ms during the client try to reconnect to the server. It depends of connectingTimer and cnxPendingTimer from the connection parameters.
-
timer
private Timer timer
-
CLOCK_SYNCHRO_THRESHOLD
public static final String CLOCK_SYNCHRO_THRESHOLD
Name of the property allowing to change the threshold of warning for the verification of the synchronization between the client and server clock. A warning is generated if there is more than this value in milliseconds between the two clocks.By default the value is 1000 milliseconds.
- See Also:
- Constant Field Values
-
clockSynchroThreshold
private long clockSynchroThreshold
Value of the threshold of warning for the verification of the synchronization between the client and server clock. A warning is generated if there is more than this value in milliseconds between the two clocks.By default the value is 1000 milliseconds.
-
-
Method Detail
-
setTimer
public void setTimer(Timer timer)
-
init
public void init(FactoryParameters params, org.objectweb.joram.shared.security.Identity identity, boolean reconnect)
-
setStatus
private void setStatus(int status)
-
connect
public void connect() throws JMSException- Throws:
JMSException
-
connect
public void connect(boolean reconnect) throws JMSException- Throws:
JMSException
-
createSocket
protected Socket createSocket(String hostname, int port) throws Exception
- Throws:
Exception
-
doConnect
private void doConnect(String hostname, int port) throws Exception, JMSException
- Throws:
ExceptionJMSException
-
throwSecurityError
private void throwSecurityError(String info) throws JMSSecurityException
- Throws:
JMSSecurityException
-
send
public void send(org.objectweb.joram.shared.client.AbstractJmsMessage request) throws Exception- Throws:
Exception
-
close
public void close()
-
addServerAddress
public void addServerAddress(String host, int port)
-
stopReconnections
public void stopReconnections()
-
-