[ 
http://issues.apache.org/jira/browse/GERONIMO-657?page=comments#action_12313393 
] 

Tom McQueeney commented on GERONIMO-657:
----------------------------------------

The shutdown hook for FileConfigurationList doesn't run because it gets 
unregistered during the kernel shutdown process. That's because the 
ConfigurationManagerImpl shutdown hook gets run FIRST, knocking the feet out 
from under any other shutdown hook registered by a GBean. This hook tells all 
loaded configurations to stop. When the FileConfigurationList  gets the 
doStop(), it dutifully unregisters it shutdown hook to save the active 
configurations. The FileConfigurationList hook never runs. 

One way to solve this problem is to ensure the ConfigurationManagerImpl 
shutdown hook runs last. To do this, we could define a shutdown hook ordering, 
such as adding a "priority" parameter to the Kernel's registerShutdownHook 
method. Something like:

    /**
     * Registers a runnable to execute when the kernel is shutdown
     * @param hook a runnable to execute when the kernel is shutdown
     */
    void registerShutdownHook(Runnable hook, int priority);

Using an int would be a quick way, and we could define two priorities, LOW and 
HIGH and ensure the ConfigurationManagerImpl  uses LOW. Or we could use an 
enumerated priority object type. Either way isn't terribly clean because the 
GBean has to have a good idea of what order its shutdown hook should run, and 
really we only need to assure that stopping all configurations is performed 
last rather than needing the other shutdown hooks to run first. Perhaps we 
could add a boolean "runLast" parameter instead of a priority parameter, and 
those with true would be added to the end of the shutdown hook list, while 
those with false would be added to the front.

I'd be happy to implement a solution like this if folks think it's a good idea.



> Running configurations not saved on shutdown
> --------------------------------------------
>
>          Key: GERONIMO-657
>          URL: http://issues.apache.org/jira/browse/GERONIMO-657
>      Project: Geronimo
>         Type: Bug
>     Reporter: Dain Sundstrom

>
> When the server shuts down the current running configuration should be saved 
> to var/config/config.list but it doesn't look like this code works anymore.  
> It would be nice if there were a test case for this functionality.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to