Class JobBackendMessage

java.lang.Object
edu.rit.pj.cluster.Message
edu.rit.pj.cluster.JobBackendMessage
All Implemented Interfaces:
Externalizable, Serializable

public abstract class JobBackendMessage extends Message implements Externalizable
Class JobBackendMessage provides a message sent to a Job Backend process (interface JobBackendRef) in the PJ cluster middleware.
Version:
02-Jul-2007
Author:
Alan Kaminsky
See Also:
  • Constructor Details

    • JobBackendMessage

      public JobBackendMessage()
      Construct a new job backend message.
    • JobBackendMessage

      public JobBackendMessage(int theTag)
      Construct a new job backend message with the given message tag.
      Parameters:
      theTag - Message tag to use when sending this message.
  • Method Details

    • cancelJob

      public static JobBackendMessage cancelJob(JobFrontendRef theJobFrontend, String errmsg)
      Construct a new "cancel job" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      errmsg - Error message string.
      Returns:
      a JobBackendMessage object.
    • commenceJob

      public static JobBackendMessage commenceJob(JobFrontendRef theJobFrontend, InetSocketAddress[] middlewareAddress, InetSocketAddress[] worldAddress, InetSocketAddress[] frontendAddress, Properties properties, String mainClassName, String[] args)
      Construct a new "commence job" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      middlewareAddress - Array of hosts/ports for middleware messages. The first K elements are for the job backend processes in rank order, the K+1st element is for the job frontend process. If the
      worldAddress - Array of hosts/ports for the world communicator. The K elements are for the job backend processes in rank order.
      frontendAddress - Array of hosts/ports for the frontend communicator. The first K elements are for the job backend processes in rank order, the K+1st element is for the job frontend process. If the frontend communicator does not exist, frontendAddress is null.
      properties - Java system properties.
      mainClassName - Fully qualified class name of the Java main program class to execute.
      args - Array of 0 or more Java command line arguments.
      Returns:
      a JobBackendMessage object.
    • jobFinished

      public static JobBackendMessage jobFinished(JobFrontendRef theJobFrontend)
      Construct a new "job finished" message.
      Parameters:
      theJobFrontend - Job frontend that is calling this method.
      Returns:
      a JobBackendMessage object.
    • renewLease

      public static JobBackendMessage renewLease(JobFrontendRef theJobFrontend)
      Construct a new "renew lease" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      Returns:
      a JobBackendMessage object.
    • reportResource

      public static JobBackendMessage reportResource(JobFrontendRef theJobFrontend, String resourceName, byte[] content)
      Construct a new "report resource" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      resourceName - Resource name.
      content - Resource content, or null if resource not found.
      Returns:
      a JobBackendMessage object.
    • reportResource

      public static JobBackendMessage reportResource(JobFrontendRef theJobFrontend, String resourceName, ByteSequence content)
      Construct a new "report resource" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      resourceName - Resource name.
      content - Resource content, or null if resource not found.
      Returns:
      a JobBackendMessage object.
    • outputFileOpenResult

      public static JobBackendMessage outputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc)
      Construct a new "output file open result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      bfd - Backend file descriptor.
      ffd - Frontend file descriptor if success.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • outputFileWriteResult

      public static JobBackendMessage outputFileWriteResult(JobFrontendRef theJobFrontend, int ffd, IOException exc)
      Construct a new "output file write result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • outputFileFlushResult

      public static JobBackendMessage outputFileFlushResult(JobFrontendRef theJobFrontend, int ffd, IOException exc)
      Construct a new "output file flush result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • outputFileCloseResult

      public static JobBackendMessage outputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc)
      Construct a new "output file close result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • inputFileOpenResult

      public static JobBackendMessage inputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc)
      Construct a new "input file open result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      bfd - Backend file descriptor.
      ffd - Frontend file descriptor if success.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • inputFileReadResult

      public static JobBackendMessage inputFileReadResult(JobFrontendRef theJobFrontend, int ffd, int len, IOException exc)
      Construct a new "input file read result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      len - Number of bytes read, or -1 if EOF.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • inputFileSkipResult

      public static JobBackendMessage inputFileSkipResult(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc)
      Construct a new "input file skip result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      len - Number of bytes skipped.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • inputFileCloseResult

      public static JobBackendMessage inputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc)
      Construct a new "input file close result" message.
      Parameters:
      theJobFrontend - Job Frontend that is calling this method.
      ffd - Frontend file descriptor.
      exc - Null if success, exception if failure.
      Returns:
      a JobBackendMessage object.
    • invoke

      public void invoke(JobBackendRef theJobBackend, JobFrontendRef theJobFrontend) throws IOException
      Invoke the method corresponding to this job backend message on the given Job Backend object. The method arguments come from the fields of this job backend message object.
      Parameters:
      theJobBackend - Job Backend on which to invoke the method.
      theJobFrontend - Job Frontend that is calling the method.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Write this job backend message to the given object output stream.
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException - Thrown if an I/O error occurred.
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Read this job backend message from the given object input stream.
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException - Thrown if an I/O error occurred.
      ClassNotFoundException - Thrown if a class needed to read this job backend message could not be found.