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:
  • Constructor Details

    • AbstractJMXConnectionWrapper

      public AbstractJMXConnectionWrapper()
      Initialize a local connection (same JVM) to the MBean server.
    • AbstractJMXConnectionWrapper

      public AbstractJMXConnectionWrapper(String host, int port, boolean sslEnabled)
      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:
      true if the connection was established in the specified time, false otherwise.
    • getId

      public String getId()
      Get a string describing this connection.
      Returns:
      a string in the format host:port.
    • getDisplayName

      public String getDisplayName()
      Get the string representing this connection, used for displaying in the admin conosle.
      Returns:
      the display name as a string.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 - true to reconnect, false otherwise.
    • getProtocol

      public String getProtocol()
      Get the JMX remote protocol used.
      Returns:
      the JMX remote protocol string.
    • getLastConnectionException

      public Throwable getLastConnectionException()
      Returns:
      the last exception received when attempting to connect, if any.