This is an automated email from the ASF dual-hosted git repository.
tkalkirill pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 50a2b1847e IGNITE-19853 Get rid of InjectRevisionListenerHolder (#2600)
50a2b1847e is described below
commit 50a2b1847e584b37aa2494abfaac0cf04d95b8e8
Author: Kirill Tkalenko <[email protected]>
AuthorDate: Tue Sep 19 10:32:54 2023 +0300
IGNITE-19853 Get rid of InjectRevisionListenerHolder (#2600)
---
.../ConfigurationListenerTestUtils.java | 20 ---
.../testframework/ConfigurationExtensionTest.java | 54 --------
.../ConfigurationStorageRevisionListener.java | 36 ------
...ConfigurationStorageRevisionListenerHolder.java | 42 -------
.../testframework/ConfigurationExtension.java | 140 +++------------------
.../InjectRevisionListenerHolder.java | 35 ------
6 files changed, 14 insertions(+), 313 deletions(-)
diff --git
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTestUtils.java
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTestUtils.java
index cbeca66d81..210b1c88b1 100644
---
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTestUtils.java
+++
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTestUtils.java
@@ -28,7 +28,6 @@ import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
-import java.util.function.LongConsumer;
import java.util.function.Supplier;
import org.apache.ignite.configuration.notifications.ConfigurationListener;
import
org.apache.ignite.configuration.notifications.ConfigurationNamedListListener;
@@ -38,12 +37,6 @@ import
org.apache.ignite.configuration.notifications.ConfigurationNotificationEv
* Utility class for testing configuration listeners.
*/
class ConfigurationListenerTestUtils {
- /**
- * Private constructor.
- */
- private ConfigurationListenerTestUtils() {
- }
-
/**
* Returns consumer who does nothing.
*/
@@ -209,19 +202,6 @@ class ConfigurationListenerTestUtils {
};
}
- /**
- * Returns configuration storage revision change listener.
- *
- * @param consumer Consumer of storage revision change.
- */
- static ConfigurationStorageRevisionListener
configStorageRevisionListener(LongConsumer consumer) {
- return (newStorageRevision) -> {
- consumer.accept(newStorageRevision);
-
- return completedFuture(null);
- };
- }
-
/**
* Returns a string representation of a random {@link UUID}.
*/
diff --git
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtensionTest.java
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtensionTest.java
index 37c96940ce..71ff1c1ec2 100644
---
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtensionTest.java
+++
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtensionTest.java
@@ -25,13 +25,9 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import
org.apache.ignite.internal.configuration.notifications.ConfigurationStorageRevisionListenerHolder;
import org.apache.ignite.internal.configuration.sample.DiscoveryConfiguration;
import
org.apache.ignite.internal.configuration.sample.ExtendedDiscoveryConfiguration;
import
org.apache.ignite.internal.configuration.sample.ExtendedDiscoveryConfigurationSchema;
@@ -49,9 +45,6 @@ class ConfigurationExtensionTest extends
BaseIgniteAbstractTest {
@InjectConfiguration(extensions =
ExtendedDiscoveryConfigurationSchema.class)
private DiscoveryConfiguration fieldCfg;
- @InjectRevisionListenerHolder
- private ConfigurationStorageRevisionListenerHolder
fieldRevisionListenerHolder;
-
@BeforeAll
static void staticParameterInjection(
@InjectConfiguration(extensions =
ExtendedDiscoveryConfigurationSchema.class) DiscoveryConfiguration paramCfg
@@ -137,53 +130,6 @@ class ConfigurationExtensionTest extends
BaseIgniteAbstractTest {
assertEquals(4, ((ExtendedConfiguration) cfg).invisible().value());
}
- @Test
- void testFieldConfigurationStorageRevisionListenerHolder() throws
Exception {
- assertNotNull(fieldRevisionListenerHolder);
-
- List<Long> revisions = new CopyOnWriteArrayList<>();
-
- fieldRevisionListenerHolder.listenUpdateStorageRevision(revision -> {
- revisions.add(revision);
-
- return completedFuture(null);
- });
-
- fieldCfg.joinTimeout().update(1_000_000).get(1, SECONDS);
-
- fieldCfg.joinTimeout().update(2_000_000).get(1, SECONDS);
-
- assertEquals(2, revisions.size(), revisions::toString);
-
- assertTrue(revisions.get(0) < revisions.get(1), revisions::toString);
- }
-
- @Test
- void testParamConfigurationStorageRevisionListenerHolder(
- @InjectConfiguration("mock.joinTimeout=100")
DiscoveryConfiguration paramCfg,
- @InjectRevisionListenerHolder
ConfigurationStorageRevisionListenerHolder paramRevisionListenerHolder
- ) throws Exception {
- assertNotNull(paramRevisionListenerHolder);
-
- assertSame(fieldRevisionListenerHolder, paramRevisionListenerHolder);
-
- List<Long> revisions = new CopyOnWriteArrayList<>();
-
- paramRevisionListenerHolder.listenUpdateStorageRevision(revision -> {
- revisions.add(revision);
-
- return completedFuture(null);
- });
-
- paramCfg.joinTimeout().update(1_000_000).get(1, SECONDS);
-
- paramCfg.joinTimeout().update(2_000_000).get(1, SECONDS);
-
- assertEquals(2, revisions.size(), revisions::toString);
-
- assertTrue(revisions.get(0) < revisions.get(1), revisions::toString);
- }
-
/** Test UUID generation in mocks. */
@Test
public void testInjectInternalId(
diff --git
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListener.java
b/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListener.java
deleted file mode 100644
index b892b4a0aa..0000000000
---
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.configuration.notifications;
-
-import java.util.concurrent.CompletableFuture;
-
-/**
- * Configuration storage revision change listener.
- *
- * <p>Storage revision - monotonously increasing counter, linked to the
specific storage for current configuration values.
- */
-@FunctionalInterface
-public interface ConfigurationStorageRevisionListener {
- /**
- * Called on update the storage version.
- *
- * @param newStorageRevision Updated configuration storage revision.
- * @return Future that signifies the end of the listener execution.
- */
- CompletableFuture<?> onUpdate(long newStorageRevision);
-}
diff --git
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListenerHolder.java
b/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListenerHolder.java
deleted file mode 100644
index 1d2dab6436..0000000000
---
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/notifications/ConfigurationStorageRevisionListenerHolder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.configuration.notifications;
-
-/**
- * Configuration storage revision change listener holder.
- */
-public interface ConfigurationStorageRevisionListenerHolder {
- /**
- * Adds configuration storage revision change listener.
- *
- * <p>NOTE: If this method is called from another listener, then it is
guaranteed to be called starting from the next configuration
- * update only.
- *
- * @param listener Listener.
- */
- void listenUpdateStorageRevision(ConfigurationStorageRevisionListener
listener);
-
- /**
- * Removes configuration storage revision change listener.
- *
- * <p>NOTE: Unpredictable behavior if the method is called inside other
listeners.
- *
- * @param listener Listener.
- */
- void stopListenUpdateStorageRevision(ConfigurationStorageRevisionListener
listener);
-}
diff --git
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtension.java
b/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtension.java
index 963d8458c6..ef0be1ebad 100644
---
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtension.java
+++
b/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/ConfigurationExtension.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.configuration.testframework;
import static java.lang.reflect.Modifier.isStatic;
+import static java.util.concurrent.CompletableFuture.allOf;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static
org.apache.ignite.configuration.annotation.ConfigurationType.LOCAL;
import static
org.apache.ignite.internal.configuration.notifications.ConfigurationNotifier.notifyListeners;
@@ -31,12 +32,9 @@ import static org.mockito.Mockito.withSettings;
import com.typesafe.config.ConfigFactory;
import com.typesafe.config.ConfigObject;
-import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
import java.util.UUID;
@@ -48,7 +46,6 @@ import java.util.function.Function;
import org.apache.ignite.configuration.ConfigurationModule;
import org.apache.ignite.configuration.RootKey;
import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance;
-import org.apache.ignite.internal.configuration.ConfigurationListenerHolder;
import org.apache.ignite.internal.configuration.DynamicConfiguration;
import org.apache.ignite.internal.configuration.DynamicConfigurationChanger;
import org.apache.ignite.internal.configuration.RootInnerNode;
@@ -56,8 +53,6 @@ import org.apache.ignite.internal.configuration.SuperRoot;
import org.apache.ignite.internal.configuration.asm.ConfigurationAsmGenerator;
import org.apache.ignite.internal.configuration.direct.KeyPathNode;
import org.apache.ignite.internal.configuration.hocon.HoconConverter;
-import
org.apache.ignite.internal.configuration.notifications.ConfigurationStorageRevisionListener;
-import
org.apache.ignite.internal.configuration.notifications.ConfigurationStorageRevisionListenerHolder;
import org.apache.ignite.internal.configuration.tree.ConfigurationSource;
import org.apache.ignite.internal.configuration.tree.InnerNode;
import org.apache.ignite.internal.configuration.util.ConfigurationUtil;
@@ -91,12 +86,6 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
/** Key to store {@link ExecutorService} in {@link
ExtensionContext.Store}. */
private static final Object POOL_KEY = new Object();
- /** Key to store {@link StorageRevisionListenerHolderImpl} in {@link
ExtensionContext.Store} for all tests. */
- private static final Object REVISION_LISTENER_ALL_TEST_HOLDER_KEY = new
Object();
-
- /** Key to store {@link StorageRevisionListenerHolderImpl} in {@link
ExtensionContext.Store} for each test. */
- private static final Object REVISION_LISTENER_PER_TEST_HOLDER_KEY = new
Object();
-
/** All {@link ConfigurationExtension} classes in classpath. */
private static final List<Class<?>> EXTENSIONS;
@@ -120,7 +109,6 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
POLYMORPHIC_EXTENSIONS = List.copyOf(polymorphicExtensions);
}
- /** {@inheritDoc} */
@Override
public void beforeAll(ExtensionContext context) throws Exception {
context.getStore(NAMESPACE).put(CGEN_KEY, new
ConfigurationAsmGenerator());
@@ -129,23 +117,19 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
injectFields(context, true);
}
- /** {@inheritDoc} */
@Override
public void afterAll(ExtensionContext context) throws Exception {
context.getStore(NAMESPACE).remove(CGEN_KEY);
context.getStore(NAMESPACE).remove(POOL_KEY,
ExecutorService.class).shutdownNow();
-
-
context.getStore(NAMESPACE).remove(REVISION_LISTENER_ALL_TEST_HOLDER_KEY);
}
- /** {@inheritDoc} */
@Override
public void beforeEach(ExtensionContext context) throws Exception {
injectFields(context, false);
}
- private void injectFields(ExtensionContext context, boolean forStatic)
throws Exception {
+ private static void injectFields(ExtensionContext context, boolean
forStatic) throws Exception {
Class<?> testClass = context.getRequiredTestClass();
Object testInstance = context.getTestInstance().orElse(null);
@@ -156,38 +140,21 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
ConfigurationAsmGenerator cgen = store.get(CGEN_KEY,
ConfigurationAsmGenerator.class);
ExecutorService pool = store.get(POOL_KEY, ExecutorService.class);
- StorageRevisionListenerHolderImpl revisionListenerHolder = new
StorageRevisionListenerHolderImpl();
-
- if (forStatic) {
- store.put(REVISION_LISTENER_ALL_TEST_HOLDER_KEY,
revisionListenerHolder);
- } else {
- store.put(REVISION_LISTENER_PER_TEST_HOLDER_KEY,
revisionListenerHolder);
- }
-
for (Field field : getInjectConfigurationFields(testClass, forStatic))
{
field.setAccessible(true);
InjectConfiguration annotation =
field.getAnnotation(InjectConfiguration.class);
- Object cfgValue = cfgValue(field.getType(), annotation, cgen,
pool, revisionListenerHolder);
+ Object cfgValue = cfgValue(field.getType(), annotation, cgen,
pool);
field.set(forStatic ? null : testInstance, cfgValue);
}
-
- for (Field field : getInjectRevisionListenerHolderFields(testClass,
forStatic)) {
- field.setAccessible(true);
-
- field.set(forStatic ? null : testInstance, revisionListenerHolder);
- }
}
- /** {@inheritDoc} */
@Override
public void afterEach(ExtensionContext context) throws Exception {
-
context.getStore(NAMESPACE).remove(REVISION_LISTENER_PER_TEST_HOLDER_KEY);
}
- /** {@inheritDoc} */
@Override
public boolean supportsParameter(
ParameterContext parameterContext,
@@ -195,11 +162,9 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
) throws ParameterResolutionException {
Class<?> parameterType = parameterContext.getParameter().getType();
- return (parameterContext.isAnnotated(InjectConfiguration.class) &&
supportsAsConfigurationType(parameterType))
- ||
(parameterContext.isAnnotated(InjectRevisionListenerHolder.class) &&
isRevisionListenerHolder(parameterType));
+ return parameterContext.isAnnotated(InjectConfiguration.class) &&
supportsAsConfigurationType(parameterType);
}
- /** {@inheritDoc} */
@Override
public Object resolveParameter(
ParameterContext parameterContext,
@@ -207,14 +172,6 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
) throws ParameterResolutionException {
Store store = extensionContext.getStore(NAMESPACE);
- StorageRevisionListenerHolderImpl revisionListenerHolder;
-
- if (isStaticExecutable(parameterContext.getDeclaringExecutable())) {
- revisionListenerHolder =
store.get(REVISION_LISTENER_ALL_TEST_HOLDER_KEY,
StorageRevisionListenerHolderImpl.class);
- } else {
- revisionListenerHolder =
store.get(REVISION_LISTENER_PER_TEST_HOLDER_KEY,
StorageRevisionListenerHolderImpl.class);
- }
-
if (parameterContext.isAnnotated(InjectConfiguration.class)) {
Parameter parameter = parameterContext.getParameter();
@@ -223,25 +180,18 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
try {
ExecutorService pool = store.get(POOL_KEY,
ExecutorService.class);
- return cfgValue(parameter.getType(),
parameter.getAnnotation(InjectConfiguration.class), cgen, pool,
- revisionListenerHolder);
+ return cfgValue(parameter.getType(),
parameter.getAnnotation(InjectConfiguration.class), cgen, pool);
} catch (ClassNotFoundException classNotFoundException) {
throw new ParameterResolutionException(
"Cannot find a configuration schema class that matches
" + parameter.getType().getCanonicalName(),
classNotFoundException
);
}
- } else if
(parameterContext.isAnnotated(InjectRevisionListenerHolder.class)) {
- return revisionListenerHolder;
} else {
throw new ParameterResolutionException("Unknown parameter:" +
parameterContext.getParameter());
}
}
- private static boolean isStaticExecutable(Executable executable) {
- return isStatic(executable.getModifiers());
- }
-
/**
* Instantiates a configuration instance for injection.
*
@@ -249,7 +199,6 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
* @param annotation Annotation present on the field or parameter.
* @param cgen Runtime code generator associated with the extension
instance.
* @param pool Single-threaded executor service to perform configuration
changes.
- * @param revisionListenerHolder Configuration storage revision change
listener holder.
* @return Mock configuration instance.
* @throws ClassNotFoundException If corresponding configuration schema
class is not found.
*/
@@ -257,8 +206,7 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
Class<?> type,
InjectConfiguration annotation,
ConfigurationAsmGenerator cgen,
- ExecutorService pool,
- StorageRevisionListenerHolderImpl revisionListenerHolder
+ ExecutorService pool
) throws ClassNotFoundException {
// Trying to find a schema class using configuration naming
convention. This code won't work for inner Java
// classes, extension is designed to mock actual configurations from
public API to configure Ignite components.
@@ -314,8 +262,11 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
// Reference that's required for notificator.
var cfgRef = new AtomicReference<DynamicConfiguration<?, ?>>();
+ AtomicLong storageRevisionCounter = new AtomicLong();
+
+ AtomicLong notificationListenerCounter = new AtomicLong();
+
cfgRef.set(cgen.instantiateCfg(rootKey, new
DynamicConfigurationChanger() {
- /** {@inheritDoc} */
@Override
public CompletableFuture<Void> change(ConfigurationSource change) {
return CompletableFuture.supplyAsync(() -> {
@@ -328,8 +279,8 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
ConfigurationUtil.dropNulls(copy);
if (superRootRef.compareAndSet(sr, copy)) {
- long storageRevision =
revisionListenerHolder.storageRev.incrementAndGet();
- long notificationNumber =
revisionListenerHolder.notificationListenerCnt.incrementAndGet();
+ long storageRevision =
storageRevisionCounter.incrementAndGet();
+ long notificationNumber =
notificationListenerCounter.incrementAndGet();
List<CompletableFuture<?>> futures = new ArrayList<>();
@@ -341,31 +292,26 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
notificationNumber
));
-
futures.addAll(revisionListenerHolder.notifyStorageRevisionListeners(storageRevision,
notificationNumber));
-
- return
CompletableFuture.allOf(futures.toArray(CompletableFuture[]::new));
+ return
allOf(futures.toArray(CompletableFuture[]::new));
}
return change(change);
}, pool).thenCompose(Function.identity());
}
- /** {@inheritDoc} */
@Override
public InnerNode getRootNode(RootKey<?, ?> rk) {
return superRootRef.get().getRoot(rk);
}
- /** {@inheritDoc} */
@Override
public <T> T getLatest(List<KeyPathNode> path) {
return findEx(path, superRootRef.get());
}
- /** {@inheritDoc} */
@Override
public long notificationCount() {
- return revisionListenerHolder.notificationListenerCnt.get();
+ return notificationListenerCounter.get();
}
}));
@@ -383,65 +329,7 @@ public class ConfigurationExtension implements
BeforeEachCallback, AfterEachCall
);
}
- private static List<Field> getInjectRevisionListenerHolderFields(Class<?>
testClass, boolean forStatic) {
- return AnnotationSupport.findAnnotatedFields(
- testClass,
- InjectRevisionListenerHolder.class,
- field -> isRevisionListenerHolder(field.getType()) &&
(isStatic(field.getModifiers()) == forStatic),
- HierarchyTraversalMode.TOP_DOWN
- );
- }
-
private static boolean supportsAsConfigurationType(Class<?> type) {
return type.getCanonicalName().endsWith("Configuration");
}
-
- private static boolean isRevisionListenerHolder(Class<?> type) {
- return
ConfigurationStorageRevisionListenerHolder.class.isAssignableFrom(type);
- }
-
- /**
- * Implementation for {@link ConfigurationExtension}.
- */
- private static class StorageRevisionListenerHolderImpl implements
ConfigurationStorageRevisionListenerHolder {
- final AtomicLong storageRev = new AtomicLong();
-
- final AtomicLong notificationListenerCnt = new AtomicLong();
-
- final
ConfigurationListenerHolder<ConfigurationStorageRevisionListener> listeners =
new ConfigurationListenerHolder<>();
-
- /** {@inheritDoc} */
- @Override
- public void
listenUpdateStorageRevision(ConfigurationStorageRevisionListener listener) {
- listeners.addListener(listener, notificationListenerCnt.get());
- }
-
- /** {@inheritDoc} */
- @Override
- public void
stopListenUpdateStorageRevision(ConfigurationStorageRevisionListener listener) {
- listeners.removeListener(listener);
- }
-
- private Collection<CompletableFuture<?>>
notifyStorageRevisionListeners(long storageRevision, long notificationNumber) {
- List<CompletableFuture<?>> futures = new ArrayList<>();
-
- for (Iterator<ConfigurationStorageRevisionListener> it =
listeners.listeners(notificationNumber); it.hasNext(); ) {
- ConfigurationStorageRevisionListener listener = it.next();
-
- try {
- CompletableFuture<?> future =
listener.onUpdate(storageRevision);
-
- assert future != null;
-
- if (future.isCompletedExceptionally() ||
future.isCancelled() || !future.isDone()) {
- futures.add(future);
- }
- } catch (Throwable t) {
- futures.add(CompletableFuture.failedFuture(t));
- }
- }
-
- return futures;
- }
- }
}
diff --git
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/InjectRevisionListenerHolder.java
b/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/InjectRevisionListenerHolder.java
deleted file mode 100644
index 12c04e9a60..0000000000
---
a/modules/configuration/src/testFixtures/java/org/apache/ignite/internal/configuration/testframework/InjectRevisionListenerHolder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.configuration.testframework;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import
org.apache.ignite.internal.configuration.notifications.ConfigurationStorageRevisionListenerHolder;
-
-/**
- * Annotation for injecting {@link ConfigurationStorageRevisionListenerHolder}
into tests.
- *
- * <p>This annotation should be used on either fields or method parameters,
one instance per test.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-// TODO: IGNITE-19853 Get rid of this annotation.
-public @interface InjectRevisionListenerHolder {
-}