public class PriorityHook extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
add(int priority,
Runnable hook)
Add a shutdown hook with a specified priority.
|
static <H extends Hooklet> |
addAndGet(H hooklet)
Add a custom shutdown hook.
|
static void |
clear() |
static PriorityHook |
getRegisteredHook() |
void |
onShutdown() |
public static boolean add(int priority,
Runnable hook)
Will prevent adding the same hook (by parameter's class) more than once, return false in that case.
priority - See Hooklet.priority()hook - Function that needs to be run during shutdown.true if hook was not present and is now addedpublic static <H extends Hooklet> H addAndGet(H hooklet)
Will prevent adding the same hook (by parameter's class) more than once, return the existing one in that case.
See Hooklet.identity().
hooklet - Hook that needs to be run during shutdown in predictable order.Hooklet instance that will be called during shutdown.public static void clear()
public void onShutdown()
public static PriorityHook getRegisteredHook()
Copyright © 2024. All rights reserved.