KiwiDropwizardLifecycles contains one method, manage, which lets you provide both a startAction and a stopAction.
Many times, for example when using a Jakarta REST Client or a RegistryAwareClient, you only need the stopAction.
In those cases you still must provide a startAction even when it is a no-op. We have a bunch of these in various services, and they all pass Guava's Runnables#doNothing() as the argument. It would be nice not to have to do this and remove the boilerplate.
This issue proposes to add a new method (or two) that allows you to provide a start action, or maybe two methods for the opposite case, to only perform a start action.
The implementations of these are trivial, since they will simply use Runnables#doNothing() for the action they don't care about. But, they make it more clear what is happening, i.e., "we only need to manage when this thing stops".
KiwiDropwizardLifecycles
contains one method,manage
, which lets you provide both astartAction
and astopAction
.Many times, for example when using a Jakarta REST
Client
or a RegistryAwareClient, you only need thestopAction
.In those cases you still must provide a
startAction
even when it is a no-op. We have a bunch of these in various services, and they all pass Guava'sRunnables#doNothing()
as the argument. It would be nice not to have to do this and remove the boilerplate.This issue proposes to add a new method (or two) that allows you to provide a start action, or maybe two methods for the opposite case, to only perform a start action.
Possible method signatures:
void manageOnlyStart(LifecycleEnvironment lifecycle, Runnable startAction)
void manageOnlyStop(LifecycleEnvironment lifecycle, Runnable stopAction)
The implementations of these are trivial, since they will simply use
Runnables#doNothing()
for the action they don't care about. But, they make it more clear what is happening, i.e., "we only need to manage when this thing stops".