Class JPPFClientConnectionImpl

java.lang.Object
org.jppf.client.JPPFClientConnectionImpl
All Implemented Interfaces:
AutoCloseable, ClientConnectionStatusHandler, JPPFClientConnection

public class JPPFClientConnectionImpl extends Object
Instances of this class represent connections to remote JPPF drivers.
Author:
Laurent Cohen
  • 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

      public JPPFClientConnectionStatus getStatus()
      Description copied from interface: ClientConnectionStatusHandler
      Get the status of this connection.
      Returns:
      a JPPFClientConnectionStatus enumerated value.
    • setStatus

      public void setStatus(JPPFClientConnectionStatus status)
      Description copied from interface: ClientConnectionStatusHandler
      Set the status of this connection.
      Parameters:
      status - a JPPFClientConnectionStatus enumerated value.
    • addClientConnectionStatusListener

      public void addClientConnectionStatusListener(ClientConnectionStatusListener listener)
      Description copied from interface: ClientConnectionStatusHandler
      Add a connection status listener to this connection's list of listeners.
      Parameters:
      listener - the listener to add to the list.
    • removeClientConnectionStatusListener

      public void removeClientConnectionStatusListener(ClientConnectionStatusListener listener)
      Description copied from interface: ClientConnectionStatusHandler
      Remove a connection status listener from this connection's list of listeners.
      Parameters:
      listener - the listener to remove from the list.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isSSLEnabled

      public boolean isSSLEnabled()
      Description copied from interface: JPPFClientConnection
      Determines if this connection is over SSL.
      Returns:
      true if this is an SSL connection, false otherwise.
    • getSystemInfo

      public org.jppf.management.JPPFSystemInformation getSystemInfo()
      Description copied from interface: JPPFClientConnection
      Get the system information for the remote driver this connection refers to.
      Returns:
      a JPPFSystemInformation instance.
    • close

      public void close()
      Shutdown this connection and retrieve all pending executions for resubmission.
    • isClosed

      public boolean isClosed()
      Description copied from interface: JPPFClientConnection
      Determine whether this connection was closed.
      Returns:
      true if the connection is closed, false otherwise.
    • getConnectionPool

      public JPPFConnectionPool getConnectionPool()
      Description copied from interface: JPPFClientConnection
      Get the pool this connection belongs to.
      Returns:
      a JPPFConnectionPool instance.
    • 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 TaskBundle instance.
      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 a SerializationHelper using the current context class loader.
      Parameters:
      classLoader - the class loader to use to load the serialization helper class.
      Returns:
      a SerializationHelper instance.
      Throws:
      Exception - if the serialization helper could not be instantiated.
    • makeHelper

      public org.jppf.serialization.SerializationHelper makeHelper(ClassLoader classLoader, String helperClassName) throws Exception
      Instantiate a SerializationHelper using 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 SerializationHelper instance.
      Throws:
      Exception - if the serialization helper could not be instantiated.
    • getName

      public String getName()
      Description copied from interface: JPPFClientConnection
      Get the name assigned to this client connection.
      Specified by:
      getName in interface JPPFClientConnection
      Returns:
      the name as a string.
    • getTaskServerConnection

      public TaskServerConnectionHandler getTaskServerConnection()
      Get the handler for the connection to the task server.
      Returns:
      a TaskServerConnectionHandler instance.
    • getClient

      public JPPFClient getClient()
      Get the JPPF client that owns this connection.
      Returns:
      an AbstractGenericClient instance.
    • getDriverUuid

      public String getDriverUuid()
      Description copied from interface: JPPFClientConnection
      Get the unique identifier of the remote driver.
      Specified by:
      getDriverUuid in interface JPPFClientConnection
      Returns:
      the uuid as a string.
    • getConnectionUuid

      public String getConnectionUuid()
      Description copied from interface: JPPFClientConnection
      Get the unique ID for this connection and its two channels.
      Specified by:
      getConnectionUuid in interface JPPFClientConnection
      Returns:
      the id as a string.
    • getHost

      public String getHost()
      Description copied from interface: JPPFClientConnection
      Get the driver's host name or ip address.
      Specified by:
      getHost in interface JPPFClientConnection
      Returns:
      the host as a stirng.
    • getPort

      public int getPort()
      Description copied from interface: JPPFClientConnection
      Get the port number on which the dirver is listeneing for connections.
      Specified by:
      getPort in interface JPPFClientConnection
      Returns:
      the port number as an int.
    • toDebugString

      protected String toDebugString()
      Get a string representing this connection for debugging purposes.
      Returns:
      a string representing this connection.