Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal.machine
Class AsynchronousFileWriter

java.lang.Object
  extended by org.openquark.cal.machine.AsynchronousFileWriter

public abstract class AsynchronousFileWriter
extends Object

Interface to allow the files generated by the compiler to be serialized to the program resource repository on a separate thread. Starts automatically when adding a file to write.

Author:
Edward Lam

Nested Class Summary
static class AsynchronousFileWriter.FileData
          The in-memory version of a file.
 
Constructor Summary
AsynchronousFileWriter()
           
 
Method Summary
abstract  void addFileToWrite(AsynchronousFileWriter.FileData fileData, CompilerMessageLogger logger)
          The compilation thread calls this method to add a file to write.
abstract  void stopAcceptingFiles()
          The compilation thread must call this method after it finishes with all calls to addFileToWrite.
abstract  void waitForFilesToBeWritten(CompilerMessageLogger logger)
          Wait for the file writer to meet the following conditions: - stopAcceptingFiles() has been called - all files have been written
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousFileWriter

public AsynchronousFileWriter()
Method Detail

stopAcceptingFiles

public abstract void stopAcceptingFiles()
The compilation thread must call this method after it finishes with all calls to addFileToWrite.


addFileToWrite

public abstract void addFileToWrite(AsynchronousFileWriter.FileData fileData,
                                    CompilerMessageLogger logger)
The compilation thread calls this method to add a file to write. This will return (almost) immediately if the AsynchronousFileWriter is not "full." Otherwise, this method will write the files on the calling thread until the pending number of bytes has been reduced and then notify the asynchronous saving thread. The file writer thread will be started the first time this is called.

Parameters:
fileData - cannot be null.
logger - the logger to use for logging error messages.

waitForFilesToBeWritten

public abstract void waitForFilesToBeWritten(CompilerMessageLogger logger)
                                      throws InterruptedException
Wait for the file writer to meet the following conditions: - stopAcceptingFiles() has been called - all files have been written

Parameters:
logger - the logger to use for logging error messages.
Throws:
InterruptedException - if the caller is interrupted while waiting.

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.