This is an automated email from the ASF dual-hosted git repository.
apolovtsev 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 c254ff249a9 IGNITE-27517 Simplify the generic parameter of
TimeoutObject (#7368)
c254ff249a9 is described below
commit c254ff249a9dd9bed079ff0fec820daa85ff9fad
Author: Alexander Polovtcev <[email protected]>
AuthorDate: Thu Jan 8 17:48:01 2026 +0200
IGNITE-27517 Simplify the generic parameter of TimeoutObject (#7368)
---
.../ignite/internal/client/TcpClientChannel.java | 4 +--
.../internal/future/timeout/TimeoutObject.java | 4 +--
.../internal/future/timeout/TimeoutWorkerTest.java | 29 ++++++++++------------
.../internal/network/DefaultMessagingService.java | 2 +-
.../internal/benchmark/FutureTimeoutBenchmark.java | 2 +-
5 files changed, 19 insertions(+), 22 deletions(-)
diff --git
a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
index 7b47c269ec3..30a6968d9ae 100644
---
a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
+++
b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
@@ -925,7 +925,7 @@ class TcpClientChannel implements ClientChannel,
ClientMessageHandler, ClientCon
void checkTimeouts(long now) {
for (Entry<Long, TimeoutObjectImpl> req : pendingReqs.entrySet()) {
- TimeoutObject<CompletableFuture<ClientMessageUnpacker>>
timeoutObject = req.getValue();
+ TimeoutObject<ClientMessageUnpacker> timeoutObject =
req.getValue();
if (timeoutObject != null && timeoutObject.endTime() > 0 && now >
timeoutObject.endTime()) {
// Client-facing future will fail with a timeout, but internal
ClientRequestFuture will stay in the map -
@@ -939,7 +939,7 @@ class TcpClientChannel implements ClientChannel,
ClientMessageHandler, ClientCon
/**
* Timeout object wrapper for the completable future.
*/
- private static class TimeoutObjectImpl implements
TimeoutObject<CompletableFuture<ClientMessageUnpacker>> {
+ private static class TimeoutObjectImpl implements
TimeoutObject<ClientMessageUnpacker> {
/** End time (milliseconds since Unix epoch). */
private final long endTime;
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/future/timeout/TimeoutObject.java
b/modules/core/src/main/java/org/apache/ignite/internal/future/timeout/TimeoutObject.java
index 2d9ffdb7b7e..63f8db8d266 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/future/timeout/TimeoutObject.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/future/timeout/TimeoutObject.java
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
* Timeout object interface.
* It is used to limit a time to wait on the future compilation.
*/
-public interface TimeoutObject<T extends CompletableFuture<?>> {
+public interface TimeoutObject<T> {
/**
* Gets end timestamp.
*
@@ -37,7 +37,7 @@ public interface TimeoutObject<T extends
CompletableFuture<?>> {
*
* @return A future.
*/
- T future();
+ CompletableFuture<T> future();
/**
* Describes the operation that has time limit. This is used to construct
TimeoutException.
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/future/timeout/TimeoutWorkerTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/future/timeout/TimeoutWorkerTest.java
index b51b6e68074..93c12951476 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/future/timeout/TimeoutWorkerTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/future/timeout/TimeoutWorkerTest.java
@@ -35,8 +35,7 @@ import java.util.function.Supplier;
import java.util.stream.Stream;
import org.apache.ignite.internal.failure.FailureContext;
import org.apache.ignite.internal.failure.FailureProcessor;
-import org.apache.ignite.internal.logger.IgniteLogger;
-import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
import org.apache.ignite.internal.testframework.WithSystemProperty;
import org.apache.ignite.internal.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
@@ -48,18 +47,16 @@ import org.junit.jupiter.params.provider.MethodSource;
* Tests for {@link TimeoutWorker}.
*/
@WithSystemProperty(key = "IGNITE_TIMEOUT_WORKER_SLEEP_INTERVAL", value = "1")
-public class TimeoutWorkerTest {
- private static final IgniteLogger LOG =
Loggers.forClass(TimeoutWorkerTest.class);
-
- private TimeoutWorker createTimeoutWorker(String name, ConcurrentMap
reqMap, FailureProcessor failureProcessor) {
- return new TimeoutWorker(LOG, "node", name, reqMap, failureProcessor);
+public class TimeoutWorkerTest extends BaseIgniteAbstractTest {
+ private TimeoutWorker createTimeoutWorker(String name, ConcurrentMap
reqMap, @Nullable FailureProcessor failureProcessor) {
+ return new TimeoutWorker(log, "node", name, reqMap, failureProcessor);
}
@Test
public void testTimeout() {
- ConcurrentMap<Long, TimeoutObject> reqMap = new ConcurrentHashMap<>();
+ ConcurrentMap<Long, TimeoutObject<?>> reqMap = new
ConcurrentHashMap<>();
- CompletableFuture<?> timeoutFuture = new CompletableFuture<>();
+ CompletableFuture<Void> timeoutFuture = new CompletableFuture<>();
TimeoutWorker worker = createTimeoutWorker("testWorker", reqMap, null);
@@ -71,13 +68,13 @@ public class TimeoutWorkerTest {
assertThat(timeoutFuture, willThrow(TimeoutException.class));
assertTrue(reqMap.isEmpty());
- awaitForWorkersStop(List.of(worker), true, LOG);
+ awaitForWorkersStop(List.of(worker), true, log);
}
@ParameterizedTest
@MethodSource("throwableProcessors")
public void testThrowableProcessor(@Nullable ThrowableProcessor processor)
{
- ConcurrentMap<Long, TimeoutObject> reqMap = new ConcurrentHashMap<>();
+ ConcurrentMap<Long, TimeoutObject<?>> reqMap = new
ConcurrentHashMap<>();
RuntimeException testException = new RuntimeException("test");
@@ -94,7 +91,7 @@ public class TimeoutWorkerTest {
assertEquals(testException, processor.throwableFuture.join());
}
- awaitForWorkersStop(List.of(worker), true, LOG);
+ awaitForWorkersStop(List.of(worker), true, log);
}
private static List<ThrowableProcessor> throwableProcessors() {
@@ -112,11 +109,11 @@ public class TimeoutWorkerTest {
}
}
- private static class TestTimeoutObject implements TimeoutObject {
+ private static class TestTimeoutObject implements TimeoutObject<Void> {
final Supplier<Long> endTimeSup;
- final CompletableFuture<?> future;
+ final CompletableFuture<Void> future;
- private TestTimeoutObject(Supplier<Long> endTimeSup,
CompletableFuture<?> future) {
+ private TestTimeoutObject(Supplier<Long> endTimeSup,
CompletableFuture<Void> future) {
this.endTimeSup = endTimeSup;
this.future = future;
}
@@ -127,7 +124,7 @@ public class TimeoutWorkerTest {
}
@Override
- public CompletableFuture<?> future() {
+ public CompletableFuture<Void> future() {
return future;
}
}
diff --git
a/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java
b/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java
index 65bb7eed443..a41f053db78 100644
---
a/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java
+++
b/modules/network/src/main/java/org/apache/ignite/internal/network/DefaultMessagingService.java
@@ -763,7 +763,7 @@ public class DefaultMessagingService extends
AbstractMessagingService {
/**
* Timeout object wrapper for the completable future.
*/
- private static class TimeoutObjectImpl implements
TimeoutObject<CompletableFuture<NetworkMessage>> {
+ private static class TimeoutObjectImpl implements
TimeoutObject<NetworkMessage> {
/** End time (milliseconds since Unix epoch). */
private final long endTime;
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/FutureTimeoutBenchmark.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/FutureTimeoutBenchmark.java
index d64ec14a9f7..451e4f45dc6 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/FutureTimeoutBenchmark.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/FutureTimeoutBenchmark.java
@@ -175,7 +175,7 @@ public class FutureTimeoutBenchmark {
/**
* Timeout object wrapper for the completable future.
*/
- private static class TimeoutObjectImpl implements
TimeoutObject<CompletableFuture<Void>> {
+ private static class TimeoutObjectImpl implements TimeoutObject<Void> {
/** End time (milliseconds since Unix epoch). */
private final long endTime;