Class AbstractClientConnectionPool

All Implemented Interfaces:
AutoCloseable, Comparable<AbstractClientConnectionPool>, Iterable<JPPFClientConnection>, ConnectionPool<JPPFClientConnection>
Direct Known Subclasses:
JPPFConnectionPool

public abstract class AbstractClientConnectionPool extends AbstractConnectionPool<JPPFClientConnection> implements Comparable<AbstractClientConnectionPool>
Instances of this class manage a list of client connections with the same pool name, priority and remote driver.

This connection pool also holds a pool of JMX connections to the same remote driver

Since:
4.1
  • Method Details

    • getConnection

      public JPPFClientConnection getConnection()
      Description copied from interface: ConnectionPool
      Get the next connection that is connected and available.
      Specified by:
      getConnection in interface ConnectionPool<JPPFClientConnection>
      Returns:
      a connection object if one is found in the desired state, or null otherwise.
    • connectionCount

      public int connectionCount(JPPFClientConnectionStatus... statuses)
      Get the number of connections in this pool that have one of the psecified statuses.

      Warning: the execution time for this method is in O(n).

      Parameters:
      statuses - the set of connection statuses to look for.
      Returns:
      the size as an int.
    • getId

      public int getId()
      Get the id of this pool.
      Returns:
      the id as an int value.
    • getPriority

      public int getPriority()
      Get the priority associated with this pool.
      Returns:
      the priority as an int.
    • isSslEnabled

      public boolean isSslEnabled()
      Check whether this pool is for SSL connections.
      Returns:
      true if SSL is enabled, false otherwise.
    • getName

      public String getName()
      Get the name of this pool.
      Returns:
      this connection pool's name.
    • getDriverUuid

      public String getDriverUuid()
      Get the uuid of the driver to which connections in this pool are connected.
      Returns:
      the driver uuid as a string.
    • compareTo

      public int compareTo(AbstractClientConnectionPool other)
      Compares this connection pool with another, based on their respective priorities.

      This comparison defines an ordering of connection pools by their descending priority.

      Specified by:
      compareTo in interface Comparable<AbstractClientConnectionPool>
      Parameters:
      other - the other connection pool to compare with.
      Returns:
      -1 if this pool's priority is greater than the other pool's, 0 if the priorities are equal, +1 if this pool's priority is less than the other pool's.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getConnections

      public List<JPPFClientConnection> getConnections(JPPFClientConnectionStatus... statuses)
      Get a list of connections held by this pool whose status is one of the specified statuses. The returned list is independent from this pool, thus changing, adding or removing elements has not effect on the pool.
      Parameters:
      statuses - an array of JPPFClientConnectionStatus values to check against.
      Returns:
      a list of JPPFClientConnection instances, possibly empty but never null.
    • getDriverHost

      public String getDriverHost()
      Get the host name of the remote driver.
      Returns:
      a string representing the host name or ip address.
      Since:
      4.2
    • getDriverIPAddress

      public String getDriverIPAddress()
      Get the ip address of the remote driver.
      Returns:
      a string representing the host name or ip address.
      Since:
      4.2
    • getDriverPort

      public int getDriverPort()
      Get the port to use on the remote driver.
      Returns:
      the port number as an int.
      Since:
      4.2
    • getClient

      public JPPFClient getClient()
      Get the JPPF client which holds this pool.
      Returns:
      a JPPFClient instance.
      Since:
      4.2
    • getSystemInfo

      public org.jppf.management.JPPFSystemInformation getSystemInfo()
      Get the driver's system information.
      Returns:
      an instance of JPPFSystemInformation.
      Since:
      4.2
    • getJmxPort

      public int getJmxPort()
      Get the jmx port to use on the remote driver.
      Returns:
      the jmx port number as an int.
      Since:
      4.2
    • getJmxConnection

      public org.jppf.management.JMXDriverConnectionWrapper getJmxConnection()
      Get a connected JMX connection among those in the JMX pool.
      Returns:
      a JMXDriverConnectionWrapper instance, or null if the JMX pool has no connected connection.
      Since:
      4.2
    • getJmxConnection

      public org.jppf.management.JMXDriverConnectionWrapper getJmxConnection(boolean connectedOnly)
      Get a JMX connection among those in the JMX pool.
      Parameters:
      connectedOnly - specifies whether to get a connection in connected state only or in any state.
      Returns:
      a JMXDriverConnectionWrapper instance, or null if the JMX pool has no connection in the specified state.
      Since:
      4.2
    • getJMXPoolMaxSize

      public int getJMXPoolMaxSize()
      Deprecated.
      use getJMXPoolSize() instead.
      Get the current maximum size of the associated JMX connection pool.
      Returns:
      the JMX pool maximum size.
      Since:
      4.2
    • setJMXPoolMaxSize

      public int setJMXPoolMaxSize(int maxSize)
      Deprecated.
      use setJMXPoolSize(int) instead.
      Set a new maximum size for the associated pool of JMX connections, adding new or closing existing connections as needed.
      Parameters:
      maxSize - the new maxsize to set.
      Returns:
      the actual new maximum size.
      Since:
      4.2
    • getJMXPoolSize

      public int getJMXPoolSize()
      Get the current maximum size of the associated JMX connection pool.
      Returns:
      the JMX pool maximum size.
      Since:
      6.0
    • setJMXPoolSize

      public int setJMXPoolSize(int maxSize)
      Set a new maximum size for the associated pool of JMX connections, adding new or closing existing connections as needed.
      Parameters:
      maxSize - the new maxsize to set.
      Returns:
      the actual new maximum size.
      Since:
      6.0
    • getMaxJobs

      public int getMaxJobs()
      Get the maximum number of jobs that can be processed concurrently by each connection.
      Returns:
      The maximum number of jobs as an int value.
    • setMaxJobs

      public int setMaxJobs(int maxJobs)
      Set the maximum number of jobs that can be processed concurrently by each connection. If the provided maxJobs is less than 1, this method has no effect.
      Parameters:
      maxJobs - the maximum number of jobs to set.
      Returns:
      the new maximum number of jobs.
    • getJMXConnections

      public List<org.jppf.management.JMXDriverConnectionWrapper> getJMXConnections()
      Get the list of connections currently in the JMX pool.
      Returns:
      a list of JMXDriverConnectionWrapper instances.
      Since:
      4.2
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class AbstractConnectionPool<JPPFClientConnection>