Package org.jppf.client
Class AbstractClientConnectionPool
java.lang.Object
org.jppf.client.AbstractConnectionPool<JPPFClientConnection>
org.jppf.client.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 Summary
Modifier and TypeMethodDescriptionvoidclose()intCompares this connection pool with another, based on their respective priorities.intconnectionCount(JPPFClientConnectionStatus... statuses) Get the number of connections in this pool that have one of the psecified statuses.booleanGet the JPPF client which holds this pool.Get the next connection that is connected and available.getConnections(JPPFClientConnectionStatus... statuses) Get a list of connections held by this pool whose status is one of the specified statuses.Get the host name of the remote driver.Get the ip address of the remote driver.intGet the port to use on the remote driver.Get the uuid of the driver to which connections in this pool are connected.intgetId()Get the id of this pool.org.jppf.management.JMXDriverConnectionWrapperGet a connected JMX connection among those in the JMX pool.org.jppf.management.JMXDriverConnectionWrappergetJmxConnection(boolean connectedOnly) Get a JMX connection among those in the JMX pool.List<org.jppf.management.JMXDriverConnectionWrapper>Get the list of connections currently in the JMX pool.intDeprecated.intGet the current maximum size of the associated JMX connection pool.intGet the jmx port to use on the remote driver.intGet the maximum number of jobs that can be processed concurrently by each connection.getName()Get the name of this pool.intGet the priority associated with this pool.org.jppf.management.JPPFSystemInformationGet the driver's system information.inthashCode()booleanCheck whether this pool is for SSL connections.intsetJMXPoolMaxSize(int maxSize) Deprecated.usesetJMXPoolSize(int)instead.intsetJMXPoolSize(int maxSize) Set a new maximum size for the associated pool of JMX connections, adding new or closing existing connections as needed.intsetMaxJobs(int maxJobs) Set the maximum number of jobs that can be processed concurrently by each connection.Methods inherited from class org.jppf.client.AbstractConnectionPool
add, connectionCount, getConnections, getSize, isEmpty, iterator, nextConnection, remove, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jppf.client.ConnectionPool
setSizeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getConnection
Description copied from interface:ConnectionPoolGet the next connection that is connected and available.- Specified by:
getConnectionin interfaceConnectionPool<JPPFClientConnection>- Returns:
- a connection object if one is found in the desired state, or
nullotherwise.
-
connectionCount
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:
trueif SSL is enabled, false otherwise.
-
getName
Get the name of this pool.- Returns:
- this connection pool's name.
-
getDriverUuid
Get the uuid of the driver to which connections in this pool are connected.- Returns:
- the driver uuid as a string.
-
compareTo
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:
compareToin interfaceComparable<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() -
equals
-
getConnections
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 ofJPPFClientConnectionStatusvalues to check against.- Returns:
- a list of
JPPFClientConnectioninstances, possibly empty but nevernull.
-
getDriverHost
Get the host name of the remote driver.- Returns:
- a string representing the host name or ip address.
- Since:
- 4.2
-
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
Get the JPPF client which holds this pool.- Returns:
- a
JPPFClientinstance. - 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
JMXDriverConnectionWrapperinstance, ornullif 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
JMXDriverConnectionWrapperinstance, ornullif the JMX pool has no connection in the specified state. - Since:
- 4.2
-
getJMXPoolMaxSize
public int getJMXPoolMaxSize()Deprecated.usegetJMXPoolSize()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.usesetJMXPoolSize(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
intvalue.
-
setMaxJobs
public int setMaxJobs(int maxJobs) Set the maximum number of jobs that can be processed concurrently by each connection. If the providedmaxJobsis 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
Get the list of connections currently in the JMX pool.- Returns:
- a list of
JMXDriverConnectionWrapperinstances. - Since:
- 4.2
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractConnectionPool<JPPFClientConnection>
-
getJMXPoolSize()instead.