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

[#215] Fix: Reverse Component Deregistration Order in AxonServerTenantProvider #228

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

schananas
Copy link
Contributor

@schananas schananas commented Oct 1, 2024

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 in AxonServerTenantProvider 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

  1. Modified the shutdown() method in AxonServerTenantProvider:

    • Now reverses the list of registrations for each tenant before cancelling them.
    • This ensures that the last registered component is the first to be deregistered.
  2. Added unit tests to verify the correct shutdown order.

  3. Updated JavaDoc for the shutdown() method to reflect its behavior and intended use.

Testing

  • Added new unit test whenShutdownThenDeregisterComponentsInReverseOrder() to verify the correct deregistration order.

This PR resolves #215.

@schananas schananas requested a review from smcvb October 1, 2024 11:12
@CLAassistant
Copy link

CLAassistant commented Oct 1, 2024

CLA assistant check
All committers have signed the CLA.

@schananas schananas changed the base branch from main to axon-multitenancy-4.10.x October 1, 2024 11:13
Copy link

sonarqubecloud bot commented Oct 1, 2024

@smcvb smcvb added this to the Release 4.10.2 milestone Oct 1, 2024
@smcvb smcvb changed the title Fix: Reverse Component Deregistration Order in AxonServerTenantProvider [#215] Fix: Reverse Component Deregistration Order in AxonServerTenantProvider Oct 2, 2024
Copy link
Member

@smcvb smcvb left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@schananas schananas merged commit 50184c3 into axon-multitenancy-4.10.x Oct 2, 2024
6 of 10 checks passed
@schananas schananas deleted the bugfix/shutdown-order branch October 2, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants