-
Enhancement
-
Resolution: Done
-
Major
-
28.0.0.Final
-
None
Currently, Installer.Builder has the following methods to manipulate the initial mode of an installed service:
- asPassive(), sets initial mode to ServiceController.Mode.PASSIVE
- asActive(), sets initial mode to ServiceController.Mode.ACTIVE
Since the default mode of an Installer is ServiceController.Mode.ON_DEMAND, I initially assumed these two methods would be sufficient.
In practice (i.e. after migrating several subsystems to use wildfly-service/subsystem), the inability to set the mode in a parameterised way, has proven to be very inconvient, as anyone whose wants to parameterise the start mode for an Installer must resort to lambdas, e.g. CapabilityServiceInstaller.Builder::asPassive. Adding (or replacing the existing methods with) a single method accepting a start mode turns out to be much simpler. It also allows users to modify the start mode for those builder(...) methods that use a non-standard start condition.
We should avoid ServiceController.Mode as this parameter for a few reasons:
- It requires a module dependency on jboss-msc
- We don't want to expose ServiceController.Mode.REMOVE or ServiceController.Mode.NEVER
Also, we can probably improve the names of these values to better describe when the installed service will start, e.g.
- StartWhen.INSTALLED = ServiceController.Mode.ACTIVE
- StartWhen.AVAILABLE = ServiceController.Mode.PASSIVE
- StartWhen.REQUIRED = ServiceController.Mode.ON_DEMAND