Class AbstractClassServerDelegate

java.lang.Object
org.jppf.client.AbstractClientConnectionHandler
org.jppf.client.AbstractClassServerDelegate
All Implemented Interfaces:
AutoCloseable, Runnable, Thread.UncaughtExceptionHandler, ClassServerDelegate

public abstract class AbstractClassServerDelegate extends AbstractClientConnectionHandler implements ClassServerDelegate, Thread.UncaughtExceptionHandler
Abstract implementation of the client end of the JPPF distributed class loader.
Author:
Laurent Cohen
  • Field Details

    • stop

      protected boolean stop
      Indicates whether this socket handler should be terminated and stop processing.
    • resourceProvider

      protected final org.jppf.classloader.ResourceProvider resourceProvider
      Reads resource files from the classpath.
    • clientUuid

      protected String clientUuid
      Unique identifier for this class server delegate, obtained from the local JPPF client.
    • handshakeDone

      protected boolean handshakeDone
      Determines if the handshake with the server has been performed.
    • formattedName

      protected final String formattedName
      Readable name for this delegate.
  • Constructor Details

    • AbstractClassServerDelegate

      protected AbstractClassServerDelegate(JPPFClientConnection owner)
      Default instantiation of this class is not permitted.
      Parameters:
      owner - the client connection which owns this connection delegate.
  • Method Details

    • getName

      public String getName()
      Get the name of this delegate.
      Specified by:
      getName in interface ClassServerDelegate
      Returns:
      the name as a string.
    • setName

      public void setName(String name)
      Set the name of this delegate.
      Specified by:
      setName in interface ClassServerDelegate
      Parameters:
      name - the name as a string.
    • initSocketClient

      public void initSocketClient() throws Exception
      Initialize this delegate's resources.
      Throws:
      Exception - if an error is raised during initialization.
    • readResource

      protected org.jppf.classloader.JPPFResourceWrapper readResource() throws Exception
      Read a resource wrapper object from the socket connection.
      Returns:
      a JPPFResourceWrapper instance.
      Throws:
      Exception - if any error is raised.
    • writeResource

      protected void writeResource(org.jppf.classloader.JPPFResourceWrapper resource) throws Exception
      Write a resource wrapper object to the socket connection.
      Parameters:
      resource - a JPPFResourceWrapper instance.
      Throws:
      Exception - if any error is raised.
    • handshake

      protected void handshake() throws Exception
      Perform the handshake with the server.
      Throws:
      Exception - if any error occurs.
    • processNextRequest

      protected void processNextRequest() throws Exception
      Process the next class laodign request from the server.
      Throws:
      Exception - if any error occcurs.
    • close

      public void close()
      Close the socket connection.
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class AbstractClientConnectionHandler
    • uncaughtException

      public void uncaughtException(Thread t, Throwable e)
      Specified by:
      uncaughtException in interface Thread.UncaughtExceptionHandler
    • init

      void init() throws Exception
      Initialize the connection.
      Throws:
      Exception - if an error is raised while initializing the connection.
    • getSocketClient

      org.jppf.comm.socket.SocketWrapper getSocketClient() throws Exception
      Get the socket client uses to communicate over a socket connection.
      Returns:
      a SocketWrapper instance.
      Throws:
      Exception - if the connection has failed or timed out.
    • isClosed

      boolean isClosed()
      Determine whether this connection handler is closed.
      Returns:
      true if this connection handler is closed, false otherwise.