[#215] Fix: Reverse Component Deregistration Order in AxonServerTenantProvider #228
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Originally issue is reported here as issue with shutdown handler introduction. After reproducing the issue, its found that issue is actually in AxonServerTenantProvider shutdown method.
Problem
The current implementation of the
shutdown()
method inAxonServerTenantProvider
deregisters components in the same order they were registered. This can lead to potential issues during application shutdown, as components that depend on others might be deregistered before the components they depend on.Solution
This PR modifies the
shutdown()
method to deregister components in the reverse order of their registration. This ensures that components are shut down in a proper sequence, allowing for any necessary cleanup operations to occur in the correct order.Changes
Modified the
shutdown()
method inAxonServerTenantProvider
:Added unit tests to verify the correct shutdown order.
Updated JavaDoc for the
shutdown()
method to reflect its behavior and intended use.Testing
whenShutdownThenDeregisterComponentsInReverseOrder()
to verify the correct deregistration order.This PR resolves #215.