public class ShutdownHookProcessDestroyer extends Object implements InstructionSequenceDestroyer, Runnable
Processes when the VM exits.| 构造器和说明 |
|---|
ShutdownHookProcessDestroyer()
Constructs a
ProcessDestroyer and obtains
Runtime.addShutdownHook() and
Runtime.removeShutdownHook() through reflection. |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(InstructionSequence 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(InstructionSequence 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.
|
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.public boolean isAddedAsShutdownHook()
public boolean add(InstructionSequence process)
true if the specified Process was
successfully added to the list of processes to destroy upon VM exit.add 在接口中 InstructionSequenceDestroyerprocess - the process to addtrue if the specified Process was
successfully addedpublic boolean remove(InstructionSequence process)
true if the specified Process was
successfully removed from the list of processes to destroy upon VM exit.remove 在接口中 InstructionSequenceDestroyerprocess - the process to removetrue if the specified Process was
successfully removedpublic int size()
size 在接口中 InstructionSequenceDestroyerCopyright © 2021. All rights reserved.