Class ProcessKiller
- java.lang.Object
-
- org.ow2.proactive.process_tree_killer.ProcessKiller
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class ProcessKiller extends java.lang.Object implements java.io.SerializableExtension point that defines more elaborate way of killing processes, such as sudo or pfexec, forProcessTree.Lifecycle
Each implementation of
ProcessKilleris instantiated once on the master. Whenever a process needs to be killed, those implementations are serialized and sent over to the appropriate slave, then thekill(ProcessTree.OSProcess)method is invoked to attempt to kill the process.One of the consequences of this design is that the implementation should be stateless and concurrent-safe. That is, the
kill(ProcessTree.OSProcess)method can be invoked by multiple threads concurrently on the single instance.Another consequence of this design is that if your
ProcessKillerrequires configuration, it needs to be serializable, and configuration needs to be updated atomically, as another thread may be calling intokill(ProcessTree.OSProcess)just when you are updating your configuration.- Since:
- 1.362
- Author:
- jpederzolli, Kohsuke Kawaguchi
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProcessKiller()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract booleankill(ProcessTree.OSProcess process)Attempts to kill the given process.
-
-
-
Method Detail
-
kill
public abstract boolean kill(ProcessTree.OSProcess process) throws java.io.IOException, java.lang.InterruptedException
Attempts to kill the given process.- Parameters:
process- process to be killed. Always a local process.- Returns:
- true if the killing was successful, and Hudson won't try to use other
ProcessKillerimplementations to kill the process. false if the killing failed or is unattempted, and Hudson will continue to use the rest of theProcessKillerimplementations to try to kill the process. - Throws:
java.io.IOException- The caller will log this exception and otherwise treat as if the method returned false, and moves on to the next killer.java.lang.InterruptedException- if the callee performs a time consuming operation and if the thread is canceled, do not catchInterruptedExceptionand just let it thrown from the method.
-
-