Thinking about it a bit more, and particularly about the comment in the user forum thread to:
1. remove any shutdown hooks in cache.stop() if this is called externally/manually
2. add some intelligence in cache.stop() to detect if it is being called by the shutdown hook and don't remove the shutdown hook in this case
With the above, do we then need any sort of manual override regarding the registration of shutdown hooks? Can we not then make do with *always* registering a shutdown hook, and then have the hook unregister if cache.stop() is called manually, or by an MBean server/microcontainer?
Saves adding a configuration element.
Re: always adding the hook, no that will break the AS. There is no way to specify ordering of shutdown hook execution. If JBC's own hook executes first, the proper undeployment ordering is not followed. For example, a clustered webapp should be undeployed before the cache is. A JBC hook executing first would break this, leading to all sorts of ugliness as the AS shutdown hook executes (this is what was happening before we put CR2 in AS 5.)
Re: DEFAULT/REGISTER/DONT_REGISTER that sounds fine.
Ok, fair enough.