Registers an exit function to be called when the JVM exits. This method can be called before or after shutdown has started, otherwise an exception will be thrown. @param exitFunction The exit function to register
(ExitFunction exitFunction)
| 125 | * @param exitFunction The exit function to register |
| 126 | */ |
| 127 | public static void registerExitFunction(ExitFunction exitFunction) |
| 128 | { |
| 129 | try |
| 130 | { |
| 131 | lock.lock(); |
| 132 | if (isShuttingDown) |
| 133 | { |
| 134 | throw new IllegalStateException("Cannot register an exit function after shutdown has started"); |
| 135 | } |
| 136 | GracefulExit.exitFunction = exitFunction; |
| 137 | } finally |
| 138 | { |
| 139 | lock.unlock(); |
| 140 | } |
| 141 | } |
| 142 | } |
no outgoing calls