Skip to content

Conversation

SentryMan
Copy link
Collaborator

@SentryMan SentryMan commented Aug 8, 2025

Now, all things being equal, will execute pre-destroy hooks in reverse registration order.

Resolves #880


Rob note: The registration order in practice is based on constructor dependencies, so as long as constructor injection is used, then the ordering of the associated @PreDestroy is deterministic and now the reverse of that.

However, if constructor injection is NOT used, then the ordering is not as deterministic and in this case we need to use explicit priority on the @PreDestroy to guarantee the correct ordering.

Now all things be equal will execute predestroy hooks in reverse order
@SentryMan SentryMan requested a review from rbygrave August 8, 2025 18:42
@SentryMan SentryMan self-assigned this Aug 8, 2025
@SentryMan SentryMan added the enhancement New feature or request label Aug 8, 2025
@SentryMan SentryMan added this to the 12.0 milestone Aug 8, 2025
@SentryMan SentryMan marked this pull request as ready for review August 8, 2025 18:42
@SentryMan SentryMan enabled auto-merge (squash) August 8, 2025 18:42
@SentryMan SentryMan merged commit e52e26d into avaje:master Aug 9, 2025
5 checks passed
@SentryMan SentryMan deleted the reverse-predestroy-order branch August 9, 2025 02:09
@rbygrave rbygrave added bug Something isn't working and removed enhancement New feature or request labels Aug 9, 2025
@rbygrave rbygrave changed the title Reverse PreDestroy Order Reverse PreDestroy Order based on constructor dependency order Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect @PreDestroy order, should be the reverse of the @PostConstructor init order

2 participants