public class JPPFClient extends AbstractGenericClient
config| Constructor and Description |
|---|
JPPFClient()
Initialize this client with an automatically generated application UUID.
|
JPPFClient(ConnectionPoolListener... listeners)
Initialize this client with an automatically generated application UUID.
|
JPPFClient(String uuid)
Initialize this client with the specified application UUID.
|
JPPFClient(String uuid,
ConnectionPoolListener... listeners)
Initialize this client with the specified application UUID and new connection listeners.
|
JPPFClient(String uuid,
org.jppf.utils.TypedProperties config,
ConnectionPoolListener... listeners)
Initialize this client with the specified application UUID and new connection listeners.
|
JPPFClient(org.jppf.utils.TypedProperties config,
ConnectionPoolListener... listeners)
Initialize this client with the specified configuration and connection listeners.
|
| Modifier and Type | Method and Description |
|---|---|
JPPFConnectionPool |
awaitActiveConnectionPool()
Wait until there is at least one connection pool with at least one connection in the
ACTIVE status. |
JPPFConnectionPool |
awaitConnectionPool(JPPFClientConnectionStatus... statuses)
Wait until there is at least one connection pool with at least one connection in one of the specified statuses.
|
JPPFConnectionPool |
awaitConnectionPool(long timeout,
JPPFClientConnectionStatus... statuses)
Wait until at least one connection pool with at least one connection in one of the specified statuses,
or until the specified timeout to expire, whichever happens first.
|
List<JPPFConnectionPool> |
awaitConnectionPools(org.jppf.utils.ComparisonOperator poolOperator,
int expectedPools,
org.jppf.utils.ComparisonOperator connectionOperator,
int expectedConnections,
long timeout,
JPPFClientConnectionStatus... statuses)
Wait until at least the specified expected connection pools satisfy the condition where the number of connections with the specified statuses
satisfy the specified connection operator, or until the specified timeout expires, whichever happens first.
|
List<JPPFConnectionPool> |
awaitConnectionPools(org.jppf.utils.ComparisonOperator operator,
int expectedConnections,
long timeout,
JPPFClientConnectionStatus... statuses)
Wait until there is at least one connection pool where the number of connections with the specified statuses
satisfy the specified condition, or until the specified timeout expires, whichever happens first.
|
List<JPPFConnectionPool> |
awaitConnectionPools(long timeout,
ConnectionPoolFilter<JPPFConnectionPool> filter)
Wait until there is at least one connection pool where at least one connections passes the specified filter,
or until the specified timeout expires, whichever happens first.
|
List<JPPFConnectionPool> |
awaitConnectionPools(long timeout,
JPPFClientConnectionStatus... statuses)
Wait until at least one connection pool with at least one connection in one of the specified statuses,
or until the specified timeout to expire, whichever happens first.
|
JPPFConnectionPool |
awaitWorkingConnectionPool()
|
List<JPPFConnectionPool> |
awaitWorkingConnectionPools()
|
List<JPPFConnectionPool> |
awaitWorkingConnectionPools(long timeout)
|
void |
close()
Close this client and release all the resources it is using.
|
org.jppf.node.policy.ExecutionPolicy |
getDefaultClientPolicy()
Get the default client-side job execution policy.
|
org.jppf.node.policy.ExecutionPolicy |
getDefaultPolicy()
Get the default server-side job execution policy.
|
org.jppf.load.balancer.LoadBalancingInformation |
getLoadBalancerSettings()
Get the current load-balancer settings.
|
List<JPPFJob> |
getQueuedJobs()
Get the list of currently queued jobs.
|
List<JPPFJob> |
getQueuedJobs(org.jppf.job.JobSelector selector)
Get a list of currently queued jobs, filtered by a
JobSelector. |
int |
getQueuedJobsCount()
Get the current number of queued jobs.
|
int |
getQueuedJobsCount(org.jppf.job.JobSelector selector)
Get the current number of jobs that satisfy a job selector.
|
void |
removeDriverDiscovery(org.jppf.discovery.ClientDriverDiscovery discovery)
Remove a custom driver discovery mechanism from those already registered.
|
void |
reset()
Reset this client, that is, close it if necessary, reload its configuration, then open it again.
|
void |
reset(org.jppf.utils.TypedProperties configuration)
Reset this client, that is, close it if necessary, then open it again, using the specified confguration.
|
void |
setDefaultClientPolicy(org.jppf.node.policy.ExecutionPolicy defaultClientPolicy)
Set the default client-side job execution policy.
|
void |
setDefaultPolicy(org.jppf.node.policy.ExecutionPolicy defaultPolicy)
Set the default server-side job execution policy.
|
void |
setLoadBalancerSettings(String algorithm,
Properties parameters)
Change the load balancer settings.
|
List<org.jppf.node.protocol.Task<?>> |
submit(JPPFJob job)
Submit the specified job for execution and wait for its completion.
|
JPPFJob |
submitAsync(JPPFJob job)
Submit the specified job asynchronously for execution, without waiting for the job to complete.
|
List<org.jppf.node.protocol.Task<?>> |
submitJob(JPPFJob job)
Deprecated.
a job should be submittable either synchronously or asynchronously, regardless of its state.
The way it is submitted is the user's choice at the time of submission, using one of
JPPFClient.submit(JPPFJob) or JPPFClient.submitAsync(JPPFJob). |
addClientQueueListener, addDriverDiscovery, cancelJob, getLoadBalancerPersistenceManagement, hasAvailableConnection, init, initPools, isLocalExecutionEnabled, isSysoutEnabled, registerClassLoader, removeClientQueueListener, setLocalExecutionEnabledaddConnectionPoolListener, findConnectionPool, findConnectionPool, findConnectionPool, findConnectionPools, findConnectionPools, findConnectionPools, getAllConnectionsCount, getClientConnection, getConfig, getConnectionPool, getConnectionPools, getConnectionPools, getPoolPriorities, getUuid, isClosed, removeConnectionPoolListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitstatusChangedpublic JPPFClient()
public JPPFClient(String uuid)
uuid - the unique identifier for this local client.public JPPFClient(ConnectionPoolListener... listeners)
listeners - the optional listeners to add to this JPPF client to receive notifications of new connections.public JPPFClient(String uuid, ConnectionPoolListener... listeners)
uuid - the unique identifier for this local client.listeners - the optional listeners to add to this JPPF client to receive notifications of new connections.public JPPFClient(org.jppf.utils.TypedProperties config,
ConnectionPoolListener... listeners)
config - the JPPF configuration to use for this client.listeners - the optional listeners to add to this JPPF client to receive notifications of new connections.public JPPFClient(String uuid, org.jppf.utils.TypedProperties config, ConnectionPoolListener... listeners)
uuid - the unique identifier for this local client.config - the JPPF configuration to use for this client.listeners - the optional listeners to add to this JPPF client to receive notifications of new connections.public List<org.jppf.node.protocol.Task<?>> submitJob(JPPFJob job)
JPPFClient.submit(JPPFJob) or JPPFClient.submitAsync(JPPFJob).job - the job to submit and execute.tasks if the job is blocking, or null if it is non-blocking.public List<org.jppf.node.protocol.Task<?>> submit(JPPFJob job)
job - the job to submit and execute.tasks.public JPPFJob submitAsync(JPPFJob job)
job - the job to submit and execute.public void reset()
JPPFClient.reset(TypedProperties)public void reset(org.jppf.utils.TypedProperties configuration)
configuration - the configuration to initialize this client with.JPPFClient.reset()public JPPFConnectionPool awaitActiveConnectionPool()
ACTIVE status.
This is a shorthand for awaitConnectionPool(Long.MAX_VALUE, JPPFClientConnectionStatus.ACTIVE).JPPFConnectionPool instance, or null if no pool has a connection in the one of the desird statuses.public JPPFConnectionPool awaitWorkingConnectionPool()
ACTIVE
or EXECUTING status.
This is a shorthand for awaitConnectionPool(Long.MAX_VALUE, JPPFClientConnectionStatus.ACTIVE, JPPFClientConnectionStatus.EXECUTING).JPPFConnectionPool instance, or null if no pool has a connection in the one of the desird statuses.public JPPFConnectionPool awaitConnectionPool(JPPFClientConnectionStatus... statuses)
awaitConnectionPool(Long.MAX_VALUE, statuses).statuses - the possible statuses of the connections in the pools to wait for.JPPFConnectionPool instance, or null if no pool has a connection in the one of the desird statuses.public JPPFConnectionPool awaitConnectionPool(long timeout, JPPFClientConnectionStatus... statuses)
timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.statuses - the possible statuses of the connections in the pools to wait for.JPPFConnectionPool instance, or null if no pool has a connection in the one of the desird statuses.public List<JPPFConnectionPool> awaitWorkingConnectionPools()
ACTIVE
or EXECUTING status.
This is a shorthand for awaitConnectionPools(Long.MAX_VALUE, JPPFClientConnectionStatus.ACTIVE, JPPFClientConnectionStatus.EXECUTING).JPPFConnectionPool instances, possibly empty but never null.public List<JPPFConnectionPool> awaitWorkingConnectionPools(long timeout)
ACTIVE
or EXECUTING status, or the specified tiemoput expires, whichever happens first.
This is a shorthand for awaitConnectionPools(tiemout, JPPFClientConnectionStatus.ACTIVE, JPPFClientConnectionStatus.EXECUTING).timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.JPPFConnectionPool instances, possibly empty but never null.public List<JPPFConnectionPool> awaitConnectionPools(long timeout, JPPFClientConnectionStatus... statuses)
timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.statuses - the possible statuses of the connections in the pools to wait for.JPPFConnectionPool instances, possibly empty but never null.public List<JPPFConnectionPool> awaitConnectionPools(org.jppf.utils.ComparisonOperator operator, int expectedConnections, long timeout, JPPFClientConnectionStatus... statuses)
operator - the condition on the number of connections to wait for. If null, it is assumed to be Operator.EQUAL.expectedConnections - the expected number of connections to wait for.timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.statuses - the possible statuses of the connections in the pools to wait for.JPPFConnectionPool instances, possibly empty but never null.public List<JPPFConnectionPool> awaitConnectionPools(org.jppf.utils.ComparisonOperator poolOperator, int expectedPools, org.jppf.utils.ComparisonOperator connectionOperator, int expectedConnections, long timeout, JPPFClientConnectionStatus... statuses)
As an example, to wait for at least 2 pools having each at least one ACTIVE connection, with a timeout of 5 seconds, one would use:
JPPFClient client = new JPPFClient(); client.awaitConnectionPools(Operator.AT_LEAST, 2, Operator.AT_LEAST, 1, 5000L, JPPFClientConnectionStatus.ACTIVE);
poolOperator - the condition on the number of expected pools to wait for. If null, it is assumed to be Operator.EQUAL.expectedPools - the expected number of pools to wait for.connectionOperator - the condition on the number of connections to wait for. If null, it is assumed to be Operator.EQUAL.expectedConnections - the expected number of connections to wait for.timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.statuses - the possible statuses of the connections in the pools to wait for.JPPFConnectionPool instances, possibly empty but never null.public List<JPPFConnectionPool> awaitConnectionPools(long timeout, ConnectionPoolFilter<JPPFConnectionPool> filter)
timeout - the maximum time to wait, in milliseconds. A value of zero means an infinite timeout.filter - an implementation of the ConnectionPoolFilter interface. A null value is interpreted as no filter (all pools are accepted).JPPFConnectionPool instances, possibly empty but never null.public void close()
AbstractJPPFClientclose in interface AutoCloseableclose in class AbstractGenericClientpublic void removeDriverDiscovery(org.jppf.discovery.ClientDriverDiscovery discovery)
discovery - the driver discovery to remove.public org.jppf.load.balancer.LoadBalancingInformation getLoadBalancerSettings()
LoadBalancingInformation instance, which encapsulates a load-balancing alfgorithm name, along with its parameters.public void setLoadBalancerSettings(String algorithm, Properties parameters) throws Exception
algorithm - the name of load-balancing alogrithm to use.parameters - the algorithm's parameters, if any. The parmeter names are assumed no to be prefixed.Exception - if any error occurs or if the algorithm name is null or not known.public org.jppf.node.policy.ExecutionPolicy getDefaultPolicy()
ExecutionPolicy, or null if none was specified.public void setDefaultPolicy(org.jppf.node.policy.ExecutionPolicy defaultPolicy)
defaultPolicy - the execution policy to set as default, may be null.public org.jppf.node.policy.ExecutionPolicy getDefaultClientPolicy()
ExecutionPolicy, or null if none was specified.public void setDefaultClientPolicy(org.jppf.node.policy.ExecutionPolicy defaultClientPolicy)
defaultClientPolicy - the execution policy to set as default, may be null.public List<JPPFJob> getQueuedJobs()
JPPFJob instances, possibly empty.public List<JPPFJob> getQueuedJobs(org.jppf.job.JobSelector selector)
JobSelector.selector - a job filter to apply. May be null, in which case all queued jobs are returned.JPPFJob instances that satisfy the provided job selector, possibly empty.public int getQueuedJobsCount()
int.public int getQueuedJobsCount(org.jppf.job.JobSelector selector)
selector - a job filter to apply. May be null, in which case the count of all queued jobs is returned.Copyright © 2005-2019 JPPF Team.