Skip to content

Commit

Permalink
add a comment about tenant segment creation, and a shutdown hook in t…
Browse files Browse the repository at this point in the history
…enant provided
schananas committed Nov 22, 2023
1 parent 7641429 commit f9a55b6
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -215,5 +215,12 @@ public Registration subscribe(MultiTenantAwareComponent bus) {
@Override
public void registerLifecycleHandlers(@Nonnull LifecycleRegistry lifecycle) {
lifecycle.onStart(Phase.INSTRUCTION_COMPONENTS + 10, this::start);
lifecycle.onShutdown(Phase.INSTRUCTION_COMPONENTS + 10, this::shutdown);
}

private void shutdown() {
registrationMap.forEach((tenant, registrationList) -> {
registrationList.forEach(Registration::cancel);
});
}
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,7 @@

/**
* Factory for creating {@link EventScheduler} segments for a given {@link TenantDescriptor}.
* After a segment is created, it may be started automatically by the factory.
*
* @author Stefan Dragisic
* @since 4.9.0

0 comments on commit f9a55b6

Please sign in to comment.