Vladislav Pyatkov created IGNITE-15823:
------------------------------------------

             Summary: 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


In the same 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 changed:
{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.3.4#803005)

Reply via email to