@Retention(value=SOURCE) @Target(value=TYPE) public @interface OnStop
Runnable
or
Callable
<Boolean>
subclasses with default constructor
which will be invoked during shutdown sequence or when the module
is being shutdown.
First of all call callables are consulted to allow or deny proceeding with the shutdown:
If the shutdown is approved, all runnables registered are acknowledged and can perform the shutdown cleanup. The runnables are invoked in parallel. It is guaranteed their execution is finished before the shutdown sequence is over:@OnStop
public class AskTheUser implements Callable{ public Boolean call() { return isItOKToShutdown() ? Boolean.TRUE : Boolean.FALSE; } }
@OnStop
public class Cleanup implements Runnable {
public void run() {
// do some cleanup
}
}
Built on October 1 2023. | Copyright © 2017-2023 Apache Software Foundation. All Rights Reserved.