Class LiveServerConnection
- java.lang.Object
-
- org.objectweb.joram.mom.dest.amqp.LiveServerConnection
-
- All Implemented Interfaces:
com.rabbitmq.client.ShutdownListener,Serializable,EventListener,LiveServerConnectionMBean
public class LiveServerConnection extends Object implements LiveServerConnectionMBean, com.rabbitmq.client.ShutdownListener, Serializable
ALiveServerConnectionkeeps alive a connection to an AMQP server. When the connection fails, a reconnection routine starts.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classLiveServerConnection.ReconnectionDaemonTheReconnectionDaemonthread is responsible for reconnecting the module with the foreign AMQP server in case of disconnection.
-
Field Summary
Fields Modifier and Type Field Description private LiveServerConnection.ReconnectionDaemoncnxDaemonprivate com.rabbitmq.client.ConnectionFactorycnxFactoryprivate com.rabbitmq.client.Connectionconnprivate static booleanDEBUGprivate Stringhostprivate static Loggerloggerprivate Stringnameprivate Stringpasswordprivate intportprivate static longserialVersionUIDdefine serialVersionUID for interoperabilityprivate Stringuser
-
Constructor Summary
Constructors Constructor Description LiveServerConnection()Starts a connection with a default AMQP server.LiveServerConnection(String name, String host, int port, String user, String password)Starts a connection with a server accessible via the factory provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.rabbitmq.client.ConnectiongetConnection()com.rabbitmq.client.ConnectionFactorygetConnectionFactory()StringgetHost()private StringgetMBeanName()StringgetName()intgetPort()StringgetState()StringgetUserName()booleanisConnectionOpen()voidshutdownCompleted(com.rabbitmq.client.ShutdownSignalException cause)voidstartLiveConnection()voidstopLiveConnection()Stops maintaining the connection alive with the server.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
cnxFactory
private transient com.rabbitmq.client.ConnectionFactory cnxFactory
-
cnxDaemon
private transient LiveServerConnection.ReconnectionDaemon cnxDaemon
-
conn
private transient volatile com.rabbitmq.client.Connection conn
-
name
private String name
-
host
private String host
-
port
private int port
-
user
private String user
-
password
private String password
-
-
Method Detail
-
startLiveConnection
public void startLiveConnection()
-
isConnectionOpen
public boolean isConnectionOpen()
-
getConnection
public com.rabbitmq.client.Connection getConnection()
-
getConnectionFactory
public com.rabbitmq.client.ConnectionFactory getConnectionFactory()
-
getMBeanName
private String getMBeanName()
-
stopLiveConnection
public void stopLiveConnection()
Stops maintaining the connection alive with the server.
-
shutdownCompleted
public void shutdownCompleted(com.rabbitmq.client.ShutdownSignalException cause)
- Specified by:
shutdownCompletedin interfacecom.rabbitmq.client.ShutdownListener
-
getHost
public String getHost()
- Specified by:
getHostin interfaceLiveServerConnectionMBean
-
getPort
public int getPort()
- Specified by:
getPortin interfaceLiveServerConnectionMBean
-
getName
public String getName()
-
getUserName
public String getUserName()
- Specified by:
getUserNamein interfaceLiveServerConnectionMBean
-
getState
public String getState()
- Specified by:
getStatein interfaceLiveServerConnectionMBean
-
-