Package org.jppf.client
Class JPPFClientConnectionImpl
java.lang.Object
org.jppf.client.JPPFClientConnectionImpl
- All Implemented Interfaces:
AutoCloseable,ClientConnectionStatusHandler,JPPFClientConnection
Instances of this class represent connections to remote JPPF drivers.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a connection status listener to this connection's list of listeners.voidclose()Shutdown this connection and retrieve all pending executions for resubmission.Get the JPPF client that owns this connection.Get the pool this connection belongs to.Get the unique ID for this connection and its two channels.Get the unique identifier of the remote driver.getHost()Get the driver's host name or ip address.getName()Get the name assigned to this client connection.intgetPort()Get the port number on which the dirver is listeneing for connections.intGet the priority assigned to this connection.Get the status of this connection.org.jppf.management.JPPFSystemInformationGet the system information for the remote driver this connection refers to.Get the handler for the connection to the task server.voidinit()booleanisClosed()Determine whether this connection was closed.booleanDetermines if this connection is over SSL.org.jppf.serialization.SerializationHelpermakeHelper(ClassLoader classLoader) Instantiate aSerializationHelperusing the current context class loader.org.jppf.serialization.SerializationHelpermakeHelper(ClassLoader classLoader, String helperClassName) Instantiate aSerializationHelperusing the current context class loader.org.jppf.node.protocol.BundleWithTasksreceiveBundleAndResults(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) Receive results of tasks execution.org.jppf.node.protocol.TaskBundlereceiveHeader(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) Receive the header part of the results of tasks execution.List<org.jppf.node.protocol.Task<?>>receiveTasks(org.jppf.node.protocol.TaskBundle bundle, org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) Receive results of tasks execution.voidRemove a connection status listener from this connection's list of listeners.List<org.jppf.node.protocol.Task<?>>sendTasks(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl, org.jppf.node.protocol.TaskBundle header, ClientTaskBundle clientBundle) Send tasks to the server for execution.voidsetStatus(JPPFClientConnectionStatus status) Set the status of this connection.voidSubmit the initialization of this connetion, some time in the future.protected StringGet a string representing this connection for debugging purposes.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jppf.client.JPPFClientConnection
isLocal
-
Method Details
-
init
public void init() -
getPriority
public int getPriority()Get the priority assigned to this connection.- Returns:
- a priority as an int value.
-
getStatus
Description copied from interface:ClientConnectionStatusHandlerGet the status of this connection.- Returns:
- a
JPPFClientConnectionStatusenumerated value.
-
setStatus
Description copied from interface:ClientConnectionStatusHandlerSet the status of this connection.- Parameters:
status- aJPPFClientConnectionStatusenumerated value.
-
addClientConnectionStatusListener
Description copied from interface:ClientConnectionStatusHandlerAdd a connection status listener to this connection's list of listeners.- Parameters:
listener- the listener to add to the list.
-
removeClientConnectionStatusListener
Description copied from interface:ClientConnectionStatusHandlerRemove a connection status listener from this connection's list of listeners.- Parameters:
listener- the listener to remove from the list.
-
toString
-
isSSLEnabled
public boolean isSSLEnabled()Description copied from interface:JPPFClientConnectionDetermines if this connection is over SSL.- Returns:
trueif this is an SSL connection,falseotherwise.
-
getSystemInfo
public org.jppf.management.JPPFSystemInformation getSystemInfo()Description copied from interface:JPPFClientConnectionGet the system information for the remote driver this connection refers to.- Returns:
- a
JPPFSystemInformationinstance.
-
close
public void close()Shutdown this connection and retrieve all pending executions for resubmission. -
isClosed
public boolean isClosed()Description copied from interface:JPPFClientConnectionDetermine whether this connection was closed.- Returns:
trueif the connection is closed,falseotherwise.
-
getConnectionPool
Description copied from interface:JPPFClientConnectionGet the pool this connection belongs to.- Returns:
- a
JPPFConnectionPoolinstance.
-
submitInitialization
public void submitInitialization()Submit the initialization of this connetion, some time in the future. -
sendTasks
public List<org.jppf.node.protocol.Task<?>> sendTasks(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl, org.jppf.node.protocol.TaskBundle header, ClientTaskBundle clientBundle) throws Exception Send tasks to the server for execution.- Parameters:
ser- the serializer to use.cl- classloader used for serialization.header- the task bundle to send to the driver.clientBundle- the job to execute remotely.- Returns:
- a list of tasks that couldn't be serialized, possibly empty.
- Throws:
Exception- if an error occurs while sending the request.
-
receiveBundleAndResults
public org.jppf.node.protocol.BundleWithTasks receiveBundleAndResults(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) throws Exception Receive results of tasks execution.- Parameters:
ser- the serializer to use.cl- the class loader to use for deserializing the tasks.- Returns:
- a pair of objects representing the executed tasks results, and the index of the first result within the initial task execution request.
- Throws:
Exception- if an error is raised while reading the results from the server.
-
receiveHeader
public org.jppf.node.protocol.TaskBundle receiveHeader(org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) throws Exception Receive the header part of the results of tasks execution.- Parameters:
ser- the serializer to use.cl- the class loader to use for deserializing the tasks.- Returns:
- a
TaskBundleinstance. - Throws:
Exception- if an error is raised while reading the results from the server.
-
receiveTasks
public List<org.jppf.node.protocol.Task<?>> receiveTasks(org.jppf.node.protocol.TaskBundle bundle, org.jppf.serialization.ObjectSerializer ser, ClassLoader cl) throws Exception Receive results of tasks execution.- Parameters:
bundle- the job header.ser- the serializer to use.cl- the class loader to use for deserializing the tasks.- Returns:
- a pair of objects representing the executed tasks results, and the index of the first result within the initial task execution request.
- Throws:
Exception- if an error is raised while reading the results from the server.
-
makeHelper
public org.jppf.serialization.SerializationHelper makeHelper(ClassLoader classLoader) throws Exception Instantiate aSerializationHelperusing the current context class loader.- Parameters:
classLoader- the class loader to use to load the serialization helper class.- Returns:
- a
SerializationHelperinstance. - Throws:
Exception- if the serialization helper could not be instantiated.
-
makeHelper
public org.jppf.serialization.SerializationHelper makeHelper(ClassLoader classLoader, String helperClassName) throws Exception Instantiate aSerializationHelperusing the current context class loader.- Parameters:
classLoader- the class loader to use to load the serialization helper class.helperClassName- the fully qualified class name of the serialization helper to use.- Returns:
- a
SerializationHelperinstance. - Throws:
Exception- if the serialization helper could not be instantiated.
-
getName
Description copied from interface:JPPFClientConnectionGet the name assigned to this client connection.- Specified by:
getNamein interfaceJPPFClientConnection- Returns:
- the name as a string.
-
getTaskServerConnection
Get the handler for the connection to the task server.- Returns:
- a
TaskServerConnectionHandlerinstance.
-
getClient
Get the JPPF client that owns this connection.- Returns:
- an
AbstractGenericClientinstance.
-
getDriverUuid
Description copied from interface:JPPFClientConnectionGet the unique identifier of the remote driver.- Specified by:
getDriverUuidin interfaceJPPFClientConnection- Returns:
- the uuid as a string.
-
getConnectionUuid
Description copied from interface:JPPFClientConnectionGet the unique ID for this connection and its two channels.- Specified by:
getConnectionUuidin interfaceJPPFClientConnection- Returns:
- the id as a string.
-
getHost
Description copied from interface:JPPFClientConnectionGet the driver's host name or ip address.- Specified by:
getHostin interfaceJPPFClientConnection- Returns:
- the host as a stirng.
-
getPort
public int getPort()Description copied from interface:JPPFClientConnectionGet the port number on which the dirver is listeneing for connections.- Specified by:
getPortin interfaceJPPFClientConnection- Returns:
- the port number as an int.
-
toDebugString
Get a string representing this connection for debugging purposes.- Returns:
- a string representing this connection.
-