Package org.jppf.management
Class AbstractJMXConnectionWrapper
java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.management.AbstractJMXConnectionWrapper
- All Implemented Interfaces:
Serializable,AutoCloseable,JPPFAdminMBean
- Direct Known Subclasses:
JMXConnectionWrapper
public abstract class AbstractJMXConnectionWrapper
extends ThreadSynchronization
implements JPPFAdminMBean, AutoCloseable
Wrapper around a JMX connection, providing a thread-safe way of handling disconnections and recovery.
- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stopped -
Constructor Summary
ConstructorsConstructorDescriptionInitialize a local connection (same JVM) to the MBean server.AbstractJMXConnectionWrapper(String host, int port, boolean sslEnabled) Initialize the connection to the remote MBean server. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidconnect()Initialize the connection to the remote MBean server.abstract booleanconnectAndWait(long timeout) Initiate the connection and wait until the connection is established or the timeout has expired, whichever comes first.Get the string representing this connection, used for displaying in the admin conosle.getId()Get a string describing this connection.Get the JMX remote protocol used.booleanvoidsetReconnectOnError(boolean reconnectOnError) Specifiy whether this connection wrapper reconnects on error.toString()Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUpMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.jppf.management.JPPFAdminMBean
systemInformation
-
Constructor Details
-
AbstractJMXConnectionWrapper
public AbstractJMXConnectionWrapper()Initialize a local connection (same JVM) to the MBean server. -
AbstractJMXConnectionWrapper
Initialize the connection to the remote MBean server.- Parameters:
host- the host the server is running on.port- the port used by the server.sslEnabled- specifies whether the jmx connection should be secure or not.
-
-
Method Details
-
connect
public abstract void connect()Initialize the connection to the remote MBean server. -
connectAndWait
public abstract boolean connectAndWait(long timeout) Initiate the connection and wait until the connection is established or the timeout has expired, whichever comes first.- Parameters:
timeout- the maximum time to wait for, a value of zero means no timeout and this method just waits until the connection is established.- Returns:
trueif the connection was established in the specified time,falseotherwise.
-
getId
Get a string describing this connection.- Returns:
- a string in the format
host:port.
-
getDisplayName
Get the string representing this connection, used for displaying in the admin conosle.- Returns:
- the display name as a string.
-
toString
-
isReconnectOnError
public boolean isReconnectOnError()- Returns:
- Whether this connection wrapper reconnects on error.
-
setReconnectOnError
public void setReconnectOnError(boolean reconnectOnError) Specifiy whether this connection wrapper reconnects on error.- Parameters:
reconnectOnError-trueto reconnect,falseotherwise.
-
getProtocol
Get the JMX remote protocol used.- Returns:
- the JMX remote protocol string.
-
getLastConnectionException
- Returns:
- the last exception received when attempting to connect, if any.
-