Update the plugin API to make the shutdown reason available to shutdown
plugins.
OpenDS Issue Number: 995
| | |
| | | * method will be called early in the shutdown process after the |
| | | * connection handlers are stopped but before other finalization is |
| | | * performed. |
| | | * |
| | | * @param reason The human-readable reason for the shutdown. |
| | | */ |
| | | public void doShutdown() |
| | | public void doShutdown(String reason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "doShutdown"); |
| | | assert debugEnter(CLASS_NAME, "doShutdown", |
| | | String.valueOf(reason)); |
| | | |
| | | int msgID = MSGID_PLUGIN_TYPE_NOT_SUPPORTED; |
| | | String message = getMessage(msgID, String.valueOf(pluginDN), |
| | |
| | | // the server. |
| | | if (directoryServer.pluginConfigManager != null) |
| | | { |
| | | directoryServer.pluginConfigManager.invokeShutdownPlugins(); |
| | | directoryServer.pluginConfigManager.invokeShutdownPlugins(reason); |
| | | directoryServer.pluginConfigManager.finalizePlugins(); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Invokes the set of shutdown plugins that have been configured in the |
| | | * Directory Server. |
| | | * |
| | | * @param reason The human-readable reason for the shutdown. |
| | | */ |
| | | public void invokeShutdownPlugins() |
| | | public void invokeShutdownPlugins(String reason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "invokeShutdownPlugins"); |
| | | assert debugEnter(CLASS_NAME, "invokeShutdownPlugins", |
| | | String.valueOf(reason)); |
| | | |
| | | |
| | | for (DirectoryServerPlugin p : shutdownPlugins) |
| | | { |
| | | try |
| | | { |
| | | p.doShutdown(); |
| | | p.doShutdown(reason); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | @Test(expectedExceptions = { UnsupportedOperationException.class }) |
| | | public void testDoShutdown() |
| | | { |
| | | new NullPlugin().doShutdown(); |
| | | new NullPlugin().doShutdown("testDoShutdown"); |
| | | } |
| | | |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public void doShutdown() |
| | | public void doShutdown(String reason) |
| | | { |
| | | shutdownCalled = true; |
| | | } |