edu.rit.pj.cluster
Class BackendFileWriter

java.lang.Object
  extended by edu.rit.pj.cluster.BackendFileWriter

public class BackendFileWriter
extends Object

Class BackendFileWriter provides an object that writes sequential files in the job backend process.

Note: Class BackendFileWriter is not multiple thread safe; it assumes it is being called by a synchronized method in the job backend.


Field Summary
 PrintStream err
          Print stream for printing on the job frontend's standard error.
 PrintStream out
          Print stream for printing on the job frontend's standard output.
 
Constructor Summary
BackendFileWriter(JobFrontendRef theJobFrontend, JobBackendRef theJobBackend)
          Construct a new backend file writer.
 
Method Summary
 BackendFileOutputStream open(File file, boolean append)
          Open a backend file output stream on the given file.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public final PrintStream out
Print stream for printing on the job frontend's standard output.


err

public final PrintStream err
Print stream for printing on the job frontend's standard error.

Constructor Detail

BackendFileWriter

public BackendFileWriter(JobFrontendRef theJobFrontend,
                         JobBackendRef theJobBackend)
Construct a new backend file writer.

Parameters:
theJobFrontend - Job Frontend.
theJobBackend - Job Backend.
Method Detail

open

public BackendFileOutputStream open(File file,
                                    boolean append)
                             throws IOException
Open a backend file output stream on the given file.

Parameters:
file - File.
append - True to append, false to overwrite.
Returns:
Backend file output stream.
Throws:
IOException - Thrown if an I/O error occurred.

outputFileOpenResult

public void outputFileOpenResult(JobFrontendRef theJobFrontend,
                                 int bfd,
                                 int ffd,
                                 IOException exc)
Report the result of opening the given output file.

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.

outputFileWriteResult

public void outputFileWriteResult(JobFrontendRef theJobFrontend,
                                  int ffd,
                                  IOException exc)
Report the result of writing the given output file.

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)
Report the result of flushing the given output file.

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)
Report the result of closing the given output file.

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.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.