Class AbstractJPPFClient

java.lang.Object
org.jppf.client.AbstractJPPFClient
All Implemented Interfaces:
AutoCloseable, EventListener, ClientConnectionStatusListener
Direct Known Subclasses:
AbstractGenericClient

public abstract class AbstractJPPFClient extends Object implements ClientConnectionStatusListener, AutoCloseable
This class provides an API to submit execution requests and administration commands, and request server information data.
It has its own unique identifier, used by the nodes, to determine whether classes from the submitting application should be dynamically reloaded or not, depending on whether the uuid has changed or not.
Author:
Laurent Cohen
  • Field Details

    • JCA_SERIALIZATION_HELPER

      protected static String JCA_SERIALIZATION_HELPER
      Name of the SerializationHelper implementation class for the JCA connector.
    • config

      protected org.jppf.utils.TypedProperties config
      The JPPF configuration properties.
  • Constructor Details

    • AbstractJPPFClient

      protected AbstractJPPFClient(String uuid)
      Initialize this client with a specified application UUID.
      Parameters:
      uuid - the unique identifier for this local client.
  • Method Details

    • getConfig

      public org.jppf.utils.TypedProperties getConfig()
      Get JPPF configuration properties. These properties are unmodifiable.
      Returns:
      TypedProperties instance. With JPPF configuration.
    • getAllConnectionsCount

      public int getAllConnectionsCount()
      Get count of all client connections handled by this JPPFClient.
      Returns:
      count of JPPFClientConnection instances.
    • getClientConnection

      public JPPFClientConnection getClientConnection(int priority, JPPFClientConnectionStatus... statuses)
      Get a connection with the specified priority that matches one of the specified statuses.
      Parameters:
      priority - the priority of the connetion to find.
      statuses - a set of statuses, one of which must match the status of the connection to find.
      Returns:
      a JPPFClientConnection that matches one of the specified statuses, or null if none could be found.
      Since:
      4.2
    • statusChanged

      public void statusChanged(ClientConnectionStatusEvent event)
      Invoked when the status of a client connection has changed.
      Specified by:
      statusChanged in interface ClientConnectionStatusListener
      Parameters:
      event - the event to notify of.
    • close

      public void close()
      Close this client and release all the resources it is using.
      Specified by:
      close in interface AutoCloseable
    • addConnectionPoolListener

      public void addConnectionPoolListener(ConnectionPoolListener listener)
      Add a listener to the list of listeners to this client.
      Parameters:
      listener - the listener to add.
    • removeConnectionPoolListener

      public void removeConnectionPoolListener(ConnectionPoolListener listener)
      Remove a listener from the list of listeners to this client.
      Parameters:
      listener - the listener to remove.
    • getUuid

      public String getUuid()
      Get the unique universal identifier for this JPPF client.
      Returns:
      the uuid as a string.
    • isClosed

      public boolean isClosed()
      Determine whether this JPPF client is closed.
      Returns:
      true if this client is closed, false otherwise.
    • getSerializationHelperClassName

      protected String getSerializationHelperClassName()
      Get the name of the serialization helper implementation class name to use.
      Returns:
      the fully qualified class name of a SerializationHelper implementation.
    • findConnectionPool

      public ConnectionPool<?> findConnectionPool(int priority, int poolId)
      Find the connection pool with the specified priority and id.
      Parameters:
      priority - the priority of the pool, helps speedup the search.
      poolId - the id of the pool to find.
      Returns:
      a JPPFConnectionPool instance, or null if no pool witht he specified id could be found.
      Since:
      4.1
    • findConnectionPool

      public JPPFConnectionPool findConnectionPool(int poolId)
      Find the connection pool with the specified id.
      Parameters:
      poolId - the id of the pool to find.
      Returns:
      a JPPFConnectionPool instance, or null if no pool with the specified id could be found.
      Since:
      4.1
    • findConnectionPool

      public JPPFConnectionPool findConnectionPool(String name)
      Find the connection pool with the specified id.
      Parameters:
      name - the name of the pool to find.
      Returns:
      a JPPFConnectionPool instance, or null if no pool with the specified name could be found.
      Since:
      4.1
    • findConnectionPools

      public List<JPPFConnectionPool> findConnectionPools(JPPFClientConnectionStatus... statuses)
      Find the connection pools that have a least one connection matching one of the specified statuses.
      Parameters:
      statuses - a set of statuses of which at least one must be matched by at least one connection in any of the returned pools.
      Returns:
      a list of JPPFConnectionPool instances, possibly empty if none were found matching the specified statuses. The pools in the list are ordered by descending priority.
      Since:
      4.2
    • findConnectionPools

      public List<JPPFConnectionPool> findConnectionPools(ConnectionPoolFilter<JPPFConnectionPool> filter)
      Find the connection pools that pass the specified filter.
      Parameters:
      filter - an implementation of the ConnectionPoolFilter interface. A null value is interpreted as no filter (all pools are accepted).
      Returns:
      a list of JPPFConnectionPool instances, possibly empty if none passed the specified filter. The pools in the list are ordered by descending priority.
      Since:
      4.2
    • findConnectionPools

      public List<JPPFConnectionPool> findConnectionPools(String pattern)
      Find the connection pools whose name matches the specified regular expression.
      Parameters:
      pattern - the regular expression to match against.
      Returns:
      a list of JPPFConnectionPool instances whose name match the input pattern, possibly empty but never null.
      Since:
      4.2
    • getConnectionPool

      public JPPFConnectionPool getConnectionPool()
      Get a pool with at least one active connection and with the highest possible priority.
      Returns:
      a JPPFConnectionPool instance, or null if no pool was found with an active connection.
      Since:
      4.2
    • getConnectionPools

      public List<JPPFConnectionPool> getConnectionPools(int priority)
      Get a set of existing connection pools with the specified priority.
      Parameters:
      priority - the priority of the pool, helps speedup the search.
      Returns:
      a list of JPPFConnectionPool instances, possibly empty but never null.
      Since:
      4.1
    • getPoolPriorities

      public List<Integer> getPoolPriorities()
      Get a list of all priorities for the currently existing pools, ordered by descending priority.
      Returns:
      a list of integers represent the priorities, possibly empty but never null.
      Since:
      4.1
    • getConnectionPools

      public List<JPPFConnectionPool> getConnectionPools()
      Get a list of existing connection pools, ordered by descending priority.
      Returns:
      a list of JPPFConnectionPool instances, possibly empty but never null.
      Since:
      4.1
    • isResetting

      public boolean isResetting()
      Determine whether this client is resetting.
      Returns:
      true if this client is resetting, false otherwise.