Package edu.rit.pj.cluster
Class JobBackendMessage
java.lang.Object
edu.rit.pj.cluster.Message
edu.rit.pj.cluster.JobBackendMessage
- All Implemented Interfaces:
Externalizable,Serializable
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:
-
Field Summary
Fields inherited from class edu.rit.pj.cluster.Message
FILE_READ_DATA, FILE_WRITE_DATA, FROM_JOB_BACKEND, FROM_JOB_FRONTEND, FROM_JOB_LAUNCHER, FROM_JOB_SCHEDULER -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new job backend message.JobBackendMessage(int theTag) Construct a new job backend message with the given message tag. -
Method Summary
Modifier and TypeMethodDescriptionstatic JobBackendMessagecancelJob(JobFrontendRef theJobFrontend, String errmsg) Construct a new "cancel job" message.static JobBackendMessagecommenceJob(JobFrontendRef theJobFrontend, InetSocketAddress[] middlewareAddress, InetSocketAddress[] worldAddress, InetSocketAddress[] frontendAddress, Properties properties, String mainClassName, String[] args) Construct a new "commence job" message.static JobBackendMessageinputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "input file close result" message.static JobBackendMessageinputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Construct a new "input file open result" message.static JobBackendMessageinputFileReadResult(JobFrontendRef theJobFrontend, int ffd, int len, IOException exc) Construct a new "input file read result" message.static JobBackendMessageinputFileSkipResult(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc) Construct a new "input file skip result" message.voidinvoke(JobBackendRef theJobBackend, JobFrontendRef theJobFrontend) Invoke the method corresponding to this job backend message on the given Job Backend object.static JobBackendMessagejobFinished(JobFrontendRef theJobFrontend) Construct a new "job finished" message.static JobBackendMessageoutputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file close result" message.static JobBackendMessageoutputFileFlushResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file flush result" message.static JobBackendMessageoutputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Construct a new "output file open result" message.static JobBackendMessageoutputFileWriteResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file write result" message.voidRead this job backend message from the given object input stream.static JobBackendMessagerenewLease(JobFrontendRef theJobFrontend) Construct a new "renew lease" message.static JobBackendMessagereportResource(JobFrontendRef theJobFrontend, String resourceName, byte[] content) Construct a new "report resource" message.static JobBackendMessagereportResource(JobFrontendRef theJobFrontend, String resourceName, ByteSequence content) Construct a new "report resource" message.voidWrite this job backend message to the given object output stream.
-
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
Construct a new "cancel job" message.- Parameters:
theJobFrontend- Job Frontend that is calling this method.errmsg- Error message string.- Returns:
- a
JobBackendMessageobject.
-
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 theworldAddress- 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,frontendAddressis 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
JobBackendMessageobject.
-
jobFinished
Construct a new "job finished" message.- Parameters:
theJobFrontend- Job frontend that is calling this method.- Returns:
- a
JobBackendMessageobject.
-
renewLease
Construct a new "renew lease" message.- Parameters:
theJobFrontend- Job Frontend that is calling this method.- Returns:
- a
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
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
JobBackendMessageobject.
-
invoke
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
Write this job backend message to the given object output stream.- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException- Thrown if an I/O error occurred.
-
readExternal
Read this job backend message from the given object input stream.- Specified by:
readExternalin interfaceExternalizable- 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.
-