Package cern.accsoft.steering.jmad.util
Class FileMonitor
- java.lang.Object
-
- cern.accsoft.steering.jmad.util.FileMonitor
-
public class FileMonitor extends java.lang.Objectpolls a file and terminates as soon as it exists.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileMonitor.ProcessTerminatedUnexpectedlyExceptionstatic classFileMonitor.WaitingFailedExceptionWill be thrown, if the waiting fails for some reason.
-
Constructor Summary
Constructors Constructor Description FileMonitor(java.io.File file)FileMonitor(java.io.File file, java.lang.Process process)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanwaitForFile()waits forever, until the file exists.booleanwaitForFile(java.lang.Long timeout)waits until a file exists.
-
-
-
Method Detail
-
waitForFile
public boolean waitForFile() throws JMadExceptionwaits forever, until the file exists.- Returns:
- true, if it exists finally, false, if the monitored process was interrupted
- Throws:
FileMonitor.WaitingFailedException- if something goes wrong during waitingJMadException
-
waitForFile
public boolean waitForFile(java.lang.Long timeout) throws JMadExceptionwaits until a file exists.- Parameters:
timeout- the maximum millisecs to wait (if null, then we wait forever ...)- Returns:
- true, if the file finally exists, false, if the monitored process was interrupted or we timed out.
- Throws:
FileMonitor.WaitingFailedException- if something goes wrong during the waitingJMadException
-
-