[
https://issues.apache.org/jira/browse/IGNITE-15823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ivan Bessonov updated IGNITE-15823:
-----------------------------------
Epic Link: IGNITE-14904
> Expected call of configuration listeners for testing
> ----------------------------------------------------
>
> Key: IGNITE-15823
> URL: https://issues.apache.org/jira/browse/IGNITE-15823
> Project: Ignite
> Issue Type: Improvement
> Reporter: Vladislav Pyatkov
> Priority: Major
> Labels: ignite-3
>
> In some test cases, need to invoke a listener when the component state
> changed (we have to have a guaranty that the listener doesn't call before).
> For example, we have a closing procedure for _TableManager _ which can change
> a component state in arbitrary time:
> {code}
> @Override public void stop() {
> if (!stopGuard.compareAndSet(false, true))
> return;
> busyLock.block();
> ...
> }
> {code}
> Depend on the _busyLock_ if holding or not, the behavior of configuration
> listener changes:
> {code}
> tablesCfg.tables().
> listenElements(new ConfigurationNamedListListener<TableView>() {
> @Override
> public @NotNull CompletableFuture<?> onCreate(@NotNull
> ConfigurationNotificationEvent<TableView> ctx) {
> if (!busyLock.enterBusy()) {
> String tblName = ctx.newValue().name();
> IgniteUuid tblId =
> IgniteUuid.fromString(((ExtendedTableView)ctx.newValue()).id());
> fireEvent(TableEvent.CREATE,
> new TableEventParameters(tblId, tblName),
> new NodeStoppingException());
> return CompletableFuture.completedFuture(new
> NodeStoppingException());
> }
> ...
> }
> }
> {code}
> We need to check both cases (when the lock hold or not) in tests.
> By the reason, we should implement specific API which allow invoking
> configuration listeners when it is expected (state guaranteed).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)