|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.exec.ShutdownHookProcessDestroyer
public class ShutdownHookProcessDestroyer
Destroys all registered Processes when the VM exits.
| Constructor Summary | |
|---|---|
ShutdownHookProcessDestroyer()
Constructs a ProcessDestroyer and obtains
Runtime.addShutdownHook() and
Runtime.removeShutdownHook() through reflection. |
|
| Method Summary | |
|---|---|
boolean |
add(Process process)
Returns true if the specified Process was
successfully added to the list of processes to destroy upon VM exit. |
boolean |
isAddedAsShutdownHook()
Returns whether or not the ProcessDestroyer is registered as as shutdown hook |
boolean |
remove(Process process)
Returns true if the specified Process was
successfully removed from the list of processes to destroy upon VM exit. |
void |
run()
Invoked by the VM when it is exiting. |
int |
size()
Returns the number of registered processes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShutdownHookProcessDestroyer()
ProcessDestroyer and obtains
Runtime.addShutdownHook() and
Runtime.removeShutdownHook() through reflection. The
ProcessDestroyer manages a list of processes to be destroyed when the VM
exits. If a process is added when the list is empty, this
ProcessDestroyer is registered as a shutdown hook. If
removing a process results in an empty list, the
ProcessDestroyer is removed as a shutdown hook.
| Method Detail |
|---|
public boolean isAddedAsShutdownHook()
public boolean add(Process process)
true if the specified Process was
successfully added to the list of processes to destroy upon VM exit.
add in interface ProcessDestroyerprocess - the process to add
true if the specified Process was
successfully addedpublic boolean remove(Process process)
true if the specified Process was
successfully removed from the list of processes to destroy upon VM exit.
remove in interface ProcessDestroyerprocess - the process to remove
true if the specified Process was
successfully removedpublic int size()
size in interface ProcessDestroyerpublic void run()
run in interface Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||