Inherits java::util::TimerTask.
Public Member Functions | |
ErrorLogFile (int timeout, String prefix, String suffix, String folder, boolean deleteOnExit, boolean retryOnError) | |
synchronized void | run () |
synchronized void | append (String str) throws IOException |
synchronized void | copy (OutputStream file) throws FileNotFoundException, IOException |
synchronized void | clear () |
synchronized void | close () |
synchronized String | getFileName () |
Protected Member Functions | |
void | finalize () throws Throwable |
ErrorLogFile
encapsulates a file adding methods to close the file when it has not been since used for long time.
In case of error while writing or creating the temporary file, the behavior depends on the value of retryOnError
. If it is true
.
The purpose of this class is to avoid having a file open when no I/O is performed for a long time. This is achieved:
The used file is identified by its name;
alma.acs.logging.dialogs.error.ErrorLogFile.ErrorLogFile | ( | int | timeout, | |
String | prefix, | |||
String | suffix, | |||
String | folder, | |||
boolean | deleteOnExit, | |||
boolean | retryOnError | |||
) |
Constructor.
timeout | The number of seconds before closing the file | |
prefix | The prefix of the temporary file | |
suffix | The suffix of the temporary file | |
folder | The name of the folder where the new file must be created; if it is null or empty, then the current folder is used | |
deleteOnExit | if true the file s deleted when the application exits | |
retryOnError | if true tries to open the file even if a previous attempt failed |
synchronized void alma.acs.logging.dialogs.error.ErrorLogFile.append | ( | String | str | ) | throws IOException |
Append a string to the temporary file.
str | The string to append in the file |
synchronized void alma.acs.logging.dialogs.error.ErrorLogFile.clear | ( | ) |
Close the file(s) freeing all the resources
This is the last method executed by this class
Referenced by alma.acs.logging.dialogs.error.ErrorLogDialog.clearAll(), and alma.acs.logging.dialogs.error.ErrorLogFile.close().
synchronized void alma.acs.logging.dialogs.error.ErrorLogFile.close | ( | ) |
Close clear the file and stop the timer.
This is the last method to execute.
References alma.acs.logging.dialogs.error.ErrorLogFile.clear().
Referenced by alma.acs.logging.dialogs.error.ErrorLogDialog.dispose(), and alma.acs.logging.dialogs.error.ErrorLogFile.finalize().
synchronized void alma.acs.logging.dialogs.error.ErrorLogFile.copy | ( | OutputStream | file | ) | throws FileNotFoundException, IOException |
Copy the file in the passed output stream
file | The stream to copy the content of the file into |
void alma.acs.logging.dialogs.error.ErrorLogFile.finalize | ( | ) | throws Throwable [protected] |
Flush and close the file when the object is destroyed by the GC
References alma.acs.logging.dialogs.error.ErrorLogFile.close().
synchronized String alma.acs.logging.dialogs.error.ErrorLogFile.getFileName | ( | ) |
synchronized void alma.acs.logging.dialogs.error.ErrorLogFile.run | ( | ) |
The method executed by the Timer
.