Package edu.rit.pj.cluster
Class JobBackendProxy
java.lang.Object
edu.rit.pj.cluster.Proxy
edu.rit.pj.cluster.JobBackendProxy
- All Implemented Interfaces:
JobBackendRef
Class JobBackendProxy provides a proxy object for sending messages to a PJ
job backend process.
- Version:
- 20-Nov-2006
- Author:
- Alan Kaminsky
-
Constructor Summary
ConstructorDescriptionJobBackendProxy
(ChannelGroup theChannelGroup, Channel theChannel) Construct a new job backend proxy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelJob
(JobFrontendRef theJobFrontend, String errmsg) Cancel the job.void
commenceJob
(JobFrontendRef theJobFrontend, InetSocketAddress[] middlewareAddress, InetSocketAddress[] worldAddress, InetSocketAddress[] frontendAddress, Properties properties, String mainClassName, String[] args) Commence the job.void
inputFileCloseResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Report the result of closing the given input file.void
inputFileOpenResult
(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Report the result of opening the given input file.void
inputFileReadResult
(JobFrontendRef theJobFrontend, int ffd, byte[] buf, int len, IOException exc) Report the result of reading the given input file.void
inputFileSkipResult
(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc) Report the result of skipping the given input file.void
jobFinished
(JobFrontendRef theJobFrontend) Report that the job finished.void
outputFileCloseResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Report the result of closing the given output file.void
outputFileFlushResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Report the result of flushing the given output file.void
outputFileOpenResult
(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) Report the result of opening the given output file.void
outputFileWriteResult
(JobFrontendRef theJobFrontend, int ffd, IOException exc) Report the result of writing the given output file.void
renewLease
(JobFrontendRef theJobFrontend) Renew the lease on the job.void
reportResource
(JobFrontendRef theJobFrontend, String resourceName, byte[] content) Report the content for a previously-requested resource.void
reportResource
(JobFrontendRef theJobFrontend, String resourceName, ByteSequence content) Report the content for a previously-requested resource.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.rit.pj.cluster.JobBackendRef
close
-
Constructor Details
-
JobBackendProxy
Construct a new job backend proxy. The proxy will use the given channel in the given channel group to send messages to the job backend process.- Parameters:
theChannelGroup
- Channel group.theChannel
- Channel.
-
-
Method Details
-
cancelJob
Cancel the job. Cancel the job.- Specified by:
cancelJob
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.errmsg
- Error message string.- Throws:
IOException
- Thrown if an I/O error occurred.
-
commenceJob
public void commenceJob(JobFrontendRef theJobFrontend, InetSocketAddress[] middlewareAddress, InetSocketAddress[] worldAddress, InetSocketAddress[] frontendAddress, Properties properties, String mainClassName, String[] args) throws IOException Commence the job.- Specified by:
commenceJob
in interfaceJobBackendRef
- 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.- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
jobFinished
Report that the job finished. Report that the job finished.- Specified by:
jobFinished
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job frontend that is calling this method.- Throws:
IOException
- Thrown if an I/O error occurred.
-
renewLease
Renew the lease on the job. Renew the lease on the job.- Specified by:
renewLease
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.- Throws:
IOException
- Thrown if an I/O error occurred.
-
reportResource
public void reportResource(JobFrontendRef theJobFrontend, String resourceName, byte[] content) throws IOException Report the content for a previously-requested resource.- Specified by:
reportResource
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.resourceName
- Resource name.content
- Resource content, or null if resource not found.- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
reportResource
public void reportResource(JobFrontendRef theJobFrontend, String resourceName, ByteSequence content) throws IOException Report the content for a previously-requested resource. Report the content for a previously-requested resource.- Specified by:
reportResource
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- aJobFrontendRef
objectresourceName
- aString
objectcontent
- aByteSequence
object- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
outputFileOpenResult
public void outputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) throws IOException Report the result of opening the given output file. Report the result of opening the given output file.- Specified by:
outputFileOpenResult
in interfaceJobBackendRef
- 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.- Throws:
IOException
- Thrown if an I/O error occurred.
-
outputFileWriteResult
public void outputFileWriteResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) throws IOException Report the result of writing the given output file. Report the result of writing the given output file.- Specified by:
outputFileWriteResult
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.ffd
- Frontend file descriptor.exc
- Null if success, exception if failure.- Throws:
IOException
- Thrown if an I/O error occurred.
-
outputFileFlushResult
public void outputFileFlushResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) throws IOException Report the result of flushing the given output file. Report the result of flushing the given output file.- Specified by:
outputFileFlushResult
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.ffd
- Frontend file descriptor.exc
- Null if success, exception if failure.- Throws:
IOException
- Thrown if an I/O error occurred.
-
outputFileCloseResult
public void outputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) throws IOException Report the result of closing the given output file. Report the result of closing the given output file.- Specified by:
outputFileCloseResult
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.ffd
- Frontend file descriptor.exc
- Null if success, exception if failure.- Throws:
IOException
- Thrown if an I/O error occurred.
-
inputFileOpenResult
public void inputFileOpenResult(JobFrontendRef theJobFrontend, int bfd, int ffd, IOException exc) throws IOException Report the result of opening the given input file. Report the result of opening the given input file.- Specified by:
inputFileOpenResult
in interfaceJobBackendRef
- 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.- Throws:
IOException
- Thrown if an I/O error occurred.
-
inputFileReadResult
public void inputFileReadResult(JobFrontendRef theJobFrontend, int ffd, byte[] buf, int len, IOException exc) throws IOException Report the result of reading the given input file. Report the result of reading the given input file.- Specified by:
inputFileReadResult
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.ffd
- Frontend file descriptor.buf
- Bytes read.len
- Number of bytes read, or -1 if EOF.exc
- Null if success, exception if failure.- Throws:
IOException
- Thrown if an I/O error occurred.
-
inputFileSkipResult
public void inputFileSkipResult(JobFrontendRef theJobFrontend, int ffd, long len, IOException exc) throws IOException Report the result of skipping the given input file. Report the result of skipping the given input file.- Specified by:
inputFileSkipResult
in interfaceJobBackendRef
- 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.- Throws:
IOException
- Thrown if an I/O error occurred.
-
inputFileCloseResult
public void inputFileCloseResult(JobFrontendRef theJobFrontend, int ffd, IOException exc) throws IOException Report the result of closing the given input file. Report the result of closing the given input file.- Specified by:
inputFileCloseResult
in interfaceJobBackendRef
- Parameters:
theJobFrontend
- Job Frontend that is calling this method.ffd
- Frontend file descriptor.exc
- Null if success, exception if failure.- Throws:
IOException
- Thrown if an I/O error occurred.
-