Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method in KiwiDropwizardLifecycles to manage and only provide a stop action #1163

Closed
sleberknight opened this issue Jul 11, 2024 · 0 comments · Fixed by #1175
Closed
Assignees
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Milestone

Comments

@sleberknight
Copy link
Member

sleberknight commented Jul 11, 2024

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.

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".

@sleberknight sleberknight added the new feature A new feature such as a new class, method, package, group of classes, etc. label Jul 11, 2024
@sleberknight sleberknight added this to the 4.2.0 milestone Jul 11, 2024
@sleberknight sleberknight self-assigned this Jul 30, 2024
sleberknight added a commit that referenced this issue Jul 30, 2024
Add methods in KiwiDropwizardLifecycles to manage and only provide a start or a stop action

Closes  #1163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant