-
Task
-
Resolution: Done
-
Major
-
32.0.0.Beta3
-
None
Follows up on WFCORE-7491 & WFCORE-7492.
WFCORE-7491 added BlockingLifecycle & NonBlockingLifecycle abstractions for use with the ServiceInstaller framework.
WFCORE-7492 added support for creating simple suspendable MSC services, where [Non]BlockingLifecycle.start()/stop() can be triggered independently via SuspendableActivity.
However, while integrating these changes into WildFly, I realise that I neglected to consider objects with terminal lifecycle methods, i.e. logic that must execute on MSC Service.stop() but, if utilising the WFCORE-7492 mechanisms, cannot reside within [Non]BlockingLifecycle.stop() (as this would otherwise preclude lifeycle restart). This means that any such MSC service would need to be split into two, where one service encapulates object construction/destrucution while a second service, requiring the first, handles the object start/stop lifecycle.
e.g.
A service providing a restartable JGroups channel can be expressed as BlockingLifecycle.compose(JChannel::connect, JChannel::disconnect), however, there is no mechanism for separately specifying JChannel.close() behaviour, nor, in general, any terminal lifecycle behaviour.
By adding a terminal lifecycle method to [Non]BlockingLifecycle, we can create simple suspendable services for these types of objects without requiring 2 MSC services.