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
ConstructorDescriptionConstruct a new job backend message.JobBackendMessage
(int theTag) Construct a new job backend message with the given message tag. -
Method Summary
Modifier and TypeMethodDescriptionstatic JobBackendMessage
cancelJob
(JobFrontendRef theJobFrontend, String errmsg) Construct a new "cancel job" message.static JobBackendMessage
commenceJob
(JobFrontendRef theJobFrontend, InetSocketAddress[] middlewareAddress, InetSocketAddress[] worldAddress, InetSocketAddress[] frontendAddress, Properties properties, String mainClassName, String[] args) Construct a new "commence job" message.static JobBackendMessage
inputFileCloseResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "input file close result" message.static JobBackendMessage
inputFileOpenResult
(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Construct a new "input file open result" message.static JobBackendMessage
inputFileReadResult
(JobFrontendRef theJobFrontend, int ffd, int len, IOException exc) Construct a new "input file read result" message.static JobBackendMessage
inputFileSkipResult
(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc) Construct a new "input file skip result" message.void
invoke
(JobBackendRef theJobBackend, JobFrontendRef theJobFrontend) Invoke the method corresponding to this job backend message on the given Job Backend object.static JobBackendMessage
jobFinished
(JobFrontendRef theJobFrontend) Construct a new "job finished" message.static JobBackendMessage
outputFileCloseResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file close result" message.static JobBackendMessage
outputFileFlushResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file flush result" message.static JobBackendMessage
outputFileOpenResult
(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Construct a new "output file open result" message.static JobBackendMessage
outputFileWriteResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Construct a new "output file write result" message.void
Read this job backend message from the given object input stream.static JobBackendMessage
renewLease
(JobFrontendRef theJobFrontend) Construct a new "renew lease" message.static JobBackendMessage
reportResource
(JobFrontendRef theJobFrontend, String resourceName, byte[] content) Construct a new "report resource" message.static JobBackendMessage
reportResource
(JobFrontendRef theJobFrontend, String resourceName, ByteSequence content) Construct a new "report resource" message.void
Write 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
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 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,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
Construct a new "job finished" message.- Parameters:
theJobFrontend
- Job frontend that is calling this method.- Returns:
- a
JobBackendMessage
object.
-
renewLease
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
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:
writeExternal
in interfaceExternalizable
- Throws:
IOException
- Thrown if an I/O error occurred.
-
readExternal
Read this job backend message from the given object input stream.- Specified by:
readExternal
in 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.
-