org.jppf.client
Class JPPFClient

java.lang.Object
  extended by org.jppf.client.AbstractJPPFClient
      extended by org.jppf.client.AbstractGenericClient
          extended by org.jppf.client.JPPFClient
All Implemented Interfaces:
EventListener, ClientConnectionStatusListener

public class JPPFClient
extends AbstractGenericClient

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jppf.client.AbstractGenericClient
AbstractGenericClient.ConnectionInitializer
 
Field Summary
 
Fields inherited from class org.jppf.client.AbstractGenericClient
availableConnections, config, executor, loadBalancer, receiverThread
 
Fields inherited from class org.jppf.client.AbstractJPPFClient
allConnections, credentials, listeners, pools, totalTaskCount, uuid
 
Constructor Summary
JPPFClient()
          Initialize this client with an automatically generated application UUID.
JPPFClient(ClientListener... listeners)
          Initialize this client with an automatically generated application UUID.
JPPFClient(String uuid)
          Initialize this client with a specified application UUID.
JPPFClient(String uuid, ClientListener... listeners)
          Initialize this client with the specified application UUID and new connection listeners.
 
Method Summary
 void close()
          Close this client and release all the resources it is using.
protected  AbstractJPPFClientConnection createConnection(String uuid, String name, JPPFConnectionInformation info)
          Create a new driver connection based on the specified parameters.
protected  void initConfig(Object configuration)
          Initialize this client's configuration.
protected  void initPools()
          Read all client connection information from the configuration and initialize the connection pools accordingly.
 JPPFStats requestStatistics()
          Deprecated. this method does not allow to chose which driver to get the statistics from. Use ((JPPFClientConnectionImpl) getConnection(java.lang.String)).getJmxConnection().statistics() instead.
 void statusChanged(ClientConnectionStatusEvent event)
          Invoked when the status of a client connection has changed.
 List<JPPFTask> submit(JPPFJob job)
          Submit a job execution request.
 
Methods inherited from class org.jppf.client.AbstractGenericClient
addRequestClassLoader, getAvailableConnections, getConfig, getExecutor, getLoadBalancer, getRequestClassLoader, handleAvailableConnection, handleAvailableConnection2, hasAvailableConnection, isLocalExecutionEnabled, newConnection, removeRequestClassLoader, setLocalExecutionEnabled
 
Methods inherited from class org.jppf.client.AbstractJPPFClient
addClientListener, connectionFailed, getAllConnectionNames, getAllConnections, getClientConnection, getClientConnection, getClientConnection, getClientConnection, getUuid, initCredentials, removeClientListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPPFClient

public JPPFClient()
Initialize this client with an automatically generated application UUID.


JPPFClient

public JPPFClient(ClientListener... listeners)
Initialize this client with an automatically generated application UUID.

Parameters:
listeners - the listeners to add to this JPPF client to receive notifications of new connections.

JPPFClient

public JPPFClient(String uuid)
Initialize this client with a specified application UUID.

Parameters:
uuid - the unique identifier for this local client.

JPPFClient

public JPPFClient(String uuid,
                  ClientListener... listeners)
Initialize this client with the specified application UUID and new connection listeners.

Parameters:
uuid - the unique identifier for this local client.
listeners - the listeners to add to this JPPF client to receive notifications of new connections.
Method Detail

initConfig

protected void initConfig(Object configuration)
Initialize this client's configuration.

Specified by:
initConfig in class AbstractGenericClient
Parameters:
configuration - an object holding the JPPF configuration.

createConnection

protected AbstractJPPFClientConnection createConnection(String uuid,
                                                        String name,
                                                        JPPFConnectionInformation info)
Create a new driver connection based on the specified parameters.

Specified by:
createConnection in class AbstractGenericClient
Parameters:
uuid - the uuid of the JPPF client.
name - the name of the connection.
info - the driver connection information.
Returns:
an instance of a subclass of AbstractJPPFClientConnection.

submit

public List<JPPFTask> submit(JPPFJob job)
                      throws Exception
Submit a job execution request.

Specified by:
submit in class AbstractJPPFClient
Parameters:
job - the job to execute.
Returns:
the list of executed tasks with their results.
Throws:
IllegalArgumentException - if the job is null or empty.
Exception - if an error occurs while sending the request.
See Also:
AbstractJPPFClient.submit(org.jppf.client.JPPFJob)

requestStatistics

public JPPFStats requestStatistics()
                            throws Exception
Deprecated. this method does not allow to chose which driver to get the statistics from. Use ((JPPFClientConnectionImpl) getConnection(java.lang.String)).getJmxConnection().statistics() instead.

Send a request to get the statistics collected by the JPPF server.

Returns:
a JPPFStats instance.
Throws:
Exception - if an error occurred while trying to get the server statistics.

close

public void close()
Close this client and release all the resources it is using.

Overrides:
close in class AbstractGenericClient

initPools

protected void initPools()
Read all client connection information from the configuration and initialize the connection pools accordingly.

Overrides:
initPools in class AbstractGenericClient

statusChanged

public void statusChanged(ClientConnectionStatusEvent event)
Invoked when the status of a client connection has changed.

Specified by:
statusChanged in interface ClientConnectionStatusListener
Overrides:
statusChanged in class AbstractGenericClient
Parameters:
event - the event to notify of.
See Also:
ClientConnectionStatusListener.statusChanged(org.jppf.client.event.ClientConnectionStatusEvent)


Copyright © 2005-2010 JPPF Team.