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 support for PreDestroy priority to control ordering #405

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

rbygrave
Copy link
Contributor

@rbygrave rbygrave commented Sep 21, 2023

This allows control of the ordering of the PreDestroy methods. It does this using a int priority value. The default/baseline value is 1000. Setting values less than that means those methods run earlier and values over than means those methods run later.

e.g. using io.avaje.inject.PreDestroy priority attribute:

// Run before all the normal pre-destroy methods
@PreDestroy(priority = 100)
void close() {... }


// Run after all the normal pre-destroy methods
@PreDestroy(priority = 2000)
void close() {... }

e.g. using @Factory @Bean ... added the destroyPriority attribute.

@Factory
class MyFactory {

  @Bean(destroyMethod = "shutdown", destroyPriority = 1500)
  Hello data() {
    ...
  }
}

This allows control of the ordering of the PreDestroy methods.
It does this using a int priority value. The default/baseline
value is 1000. Setting values less than that means those
methods run earlier and values over than means those methods
run later.
@rbygrave rbygrave self-assigned this Sep 21, 2023
@rbygrave rbygrave added this to the 9.6 milestone Sep 21, 2023
@rbygrave rbygrave added the enhancement New feature or request label Sep 21, 2023
Copy link
Collaborator

@SentryMan SentryMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SentryMan SentryMan merged commit bb7d57a into master Sep 21, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants