protected static class FileMonitoringTask.FileMonitoringController extends Controller
watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) can transfer the implementation.| Modifier | Constructor and Description |
|---|---|
protected |
FileMonitoringController(hudson.FilePath ws) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup(hudson.FilePath workspace)
Cleans up after a task is done.
|
hudson.FilePath |
controlDir(hudson.FilePath ws)
Directory in which this controller can place files.
|
Integer |
exitStatus(hudson.FilePath workspace,
hudson.Launcher launcher,
hudson.model.TaskListener listener)
Checks whether the task has finished.
|
protected Integer |
exitStatus(hudson.FilePath workspace,
hudson.model.TaskListener listener)
Like
exitStatus(FilePath, Launcher, TaskListener) but not requesting a Launcher, which would not be available in watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) mode anyway. |
String |
getDiagnostics(hudson.FilePath workspace,
hudson.Launcher launcher)
Should be overridden to provide specific information about the status of an external process, for diagnostic purposes.
|
hudson.FilePath |
getLastLocationFile(hudson.FilePath workspace)
File in which a last-read position is stored if
watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) is used. |
hudson.FilePath |
getLogFile(hudson.FilePath workspace)
File in which the stdout/stderr (or, if
DurableTask.captureOutput() is called, just stderr) is written. |
protected byte[] |
getOutput(hudson.FilePath workspace)
Like
getOutput(FilePath, Launcher) but not requesting a Launcher, which would not be available in watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) mode anyway. |
byte[] |
getOutput(hudson.FilePath workspace,
hudson.Launcher launcher)
Obtain the process output.
|
hudson.FilePath |
getOutputFile(hudson.FilePath workspace)
File in which the stdout is written, if
DurableTask.captureOutput() is called. |
hudson.FilePath |
getResultFile(hudson.FilePath workspace)
File in which the exit code of the process should be reported.
|
void |
stop(hudson.FilePath workspace,
hudson.Launcher launcher)
Tries to stop any running task.
|
void |
watch(hudson.FilePath workspace,
Handler handler,
hudson.model.TaskListener listener)
Begins watching the process asynchronously, so that the master may receive notification when output is available or the process has exited.
|
boolean |
writeLog(hudson.FilePath workspace,
OutputStream sink)
Obtains any new task log output.
|
exitStatus, exitStatus, stopprotected FileMonitoringController(hudson.FilePath ws)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic final boolean writeLog(hudson.FilePath workspace,
OutputStream sink)
throws IOException,
InterruptedException
ControllerwriteLog in class Controllerworkspace - the workspace in usesink - where to send new log outputIOExceptionInterruptedExceptionDurableTask.charset(java.nio.charset.Charset),
DurableTask.defaultCharset()public Integer exitStatus(hudson.FilePath workspace, hudson.Launcher launcher, hudson.model.TaskListener listener) throws IOException, InterruptedException
ControllerexitStatus in class Controllerworkspace - the workspace in uselauncher - a way to start processes (currently unused)listener - a way to report special messagesIOExceptionInterruptedException@CheckForNull protected Integer exitStatus(hudson.FilePath workspace, hudson.model.TaskListener listener) throws IOException, InterruptedException
exitStatus(FilePath, Launcher, TaskListener) but not requesting a Launcher, which would not be available in watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) mode anyway.IOExceptionInterruptedExceptionpublic byte[] getOutput(hudson.FilePath workspace,
hudson.Launcher launcher)
throws IOException,
InterruptedException
ControllerController.exitStatus(FilePath, Launcher) has returned a non-null status.
The result is undefined if DurableTask.captureOutput() was not called before launch; generally an IOException will result.getOutput in class Controllerworkspace - the workspace in uselauncher - a way to start processes (currently unused)IOExceptionInterruptedExceptionDurableTask.charset(java.nio.charset.Charset),
DurableTask.defaultCharset()protected byte[] getOutput(hudson.FilePath workspace)
throws IOException,
InterruptedException
getOutput(FilePath, Launcher) but not requesting a Launcher, which would not be available in watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) mode anyway.IOExceptionInterruptedExceptionpublic final void stop(hudson.FilePath workspace,
hudson.Launcher launcher)
throws IOException,
InterruptedException
Controllerstop in class Controllerworkspace - the workspace in uselauncher - a way to start processesIOExceptionInterruptedExceptionpublic void cleanup(hudson.FilePath workspace)
throws IOException,
InterruptedException
ControllerDurableTask.launch(hudson.EnvVars, hudson.FilePath, hudson.Launcher, hudson.model.TaskListener).cleanup in class Controllerworkspace - the workspace in useIOExceptionInterruptedExceptionpublic hudson.FilePath controlDir(hudson.FilePath ws)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic hudson.FilePath getResultFile(hudson.FilePath workspace)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic hudson.FilePath getLogFile(hudson.FilePath workspace)
throws IOException,
InterruptedException
DurableTask.captureOutput() is called, just stderr) is written.IOExceptionInterruptedExceptionpublic hudson.FilePath getOutputFile(hudson.FilePath workspace)
throws IOException,
InterruptedException
DurableTask.captureOutput() is called.IOExceptionInterruptedExceptionpublic String getDiagnostics(hudson.FilePath workspace, hudson.Launcher launcher) throws IOException, InterruptedException
ControllergetDiagnostics in class ControllerObject.toString() by defaultIOExceptionInterruptedExceptionpublic void watch(hudson.FilePath workspace,
Handler handler,
hudson.model.TaskListener listener)
throws IOException,
InterruptedException,
ClassCastException
ControllerController.writeLog(hudson.FilePath, java.io.OutputStream) or Controller.cleanup(hudson.FilePath) in this case; you do not need to call Controller.exitStatus(FilePath, Launcher) frequently,
though it is advisable to still call it occasionally to verify that the process is still running.watch in class Controllerworkspace - the workspace in usehandler - a remotable callbacklistener - a remotable destination for messagesIOException - if initiating the watch fails, for example with a ChannelClosedExceptionInterruptedExceptionClassCastExceptionpublic hudson.FilePath getLastLocationFile(hudson.FilePath workspace)
throws IOException,
InterruptedException
watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) is used.IOExceptionInterruptedExceptionCopyright © 2016–2018. All rights reserved.