Add method in KiwiDropwizardLifecycles to manage and only provide a stop action #1163
Labels
new feature
A new feature such as a new class, method, package, group of classes, etc.
Milestone
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".The text was updated successfully, but these errors were encountered: