Hi everyone, I've had a deeper look in DefaultShutdownStrategy and there are several things that puzzle me.
I want to submit a patch in order to improve this class but I prefer discussing this first. I apologize for this very long email. Question #1: Should it be stateful or stateless ? Today, 2 concurrent shutdown operations will step on each-other toes, they both modify : timeoutOccurred, currentShutdownTaskFuture, forceShutdown and then the actual shutdown will be executed one after the other Thus, should I : * Make it stateless and thus returning an object with the status of the shutdown * Make it stateful and preventing concurrent calls to any shutdown method * Leave it that way If I had to choose I would add a stateless shutdown method with backward compatibility with existing methods (marked as deprecated) Question #2: Can a single DefaultShutdownStategy instance be used by 2 different contexts ? The 2 contexs are : * a camelContext member that is used for the management of the ExecutorService. * there's another one as first parameter of each shutdown method used to know the inflight repository and the ShutdownStrategy itself If 2 context are sharing a single DefaultShutdownStrategy: * what should happen if your using the ShutdownStrategy of another context ? * what happens to the other one if the one that created the ExecutorService stops ? Thus, should I : * Ensure that your DefaultShutdownStrategy is used by only one context. Thus remove the context parameter of each shutdown method and prevent from changing the context once defined * Allow the DefaultShutdownStrategy to be used by several context and remove the camelContext member. * Leave it that way If I had to choose I would allow the DefaultShutdownStrategy to be used by several contexts Question #3: Should it be possible to interrupt the forceShutdown process ? There's no timeout on the forceShutdown process, it can have a deadlock. Should we try to prevent this ? Question #4: Should we ensure that the service is indeed started before performing a shutdown ? Thanks for your insights on this subject Antoine