Skip to content

Commit 745324c

Browse files
committed
feat(java-concurrent): Refactor smoke tests
1 parent 51d26b3 commit 745324c

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

dd-smoke-tests/concurrent/java-21/src/main/java/datadog/smoketest/concurrent/VirtualThreadExecuteCalculator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public long computeFibonacci(int n) throws ExecutionException, InterruptedExcept
2020
return task.result.get();
2121
}
2222

23+
@Override
24+
public void close() {
25+
this.executor.shutdown();
26+
}
27+
2328
public class FibonacciExecuteTask implements Runnable {
2429
private final long n;
2530
private final CompletableFuture<Long> result;
@@ -46,9 +51,4 @@ public void run() {
4651
}
4752
}
4853
}
49-
50-
@Override
51-
public void close() {
52-
this.executor.shutdown();
53-
}
5454
}

dd-smoke-tests/concurrent/java-21/src/main/java/datadog/smoketest/concurrent/VirtualThreadInvokeAllCalculator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public long computeFibonacci(int n) throws ExecutionException, InterruptedExcept
2323
return this.executor.invokeAll(of(task)).getFirst().get();
2424
}
2525

26+
@Override
27+
public void close() {
28+
this.executor.shutdown();
29+
}
30+
2631
public class FibonacciSubmitTask implements Callable<Long> {
2732
private final long n;
2833

@@ -41,9 +46,4 @@ public Long call() throws ExecutionException, InterruptedException {
4146
return futures.getFirst().get() + futures.getLast().get();
4247
}
4348
}
44-
45-
@Override
46-
public void close() {
47-
this.executor.shutdown();
48-
}
4949
}

dd-smoke-tests/concurrent/java-21/src/main/java/datadog/smoketest/concurrent/VirtualThreadInvokeAnyCalculator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public long computeFibonacci(int n) throws ExecutionException, InterruptedExcept
2121
return this.executor.invokeAny(of(task));
2222
}
2323

24+
@Override
25+
public void close() {
26+
this.executor.shutdown();
27+
}
28+
2429
public class FibonacciSubmitTask implements Callable<Long> {
2530
private final long n;
2631

@@ -38,9 +43,4 @@ public Long call() throws ExecutionException, InterruptedException {
3843
return executor.invokeAny(of(task1)) + executor.invokeAny(of(task2));
3944
}
4045
}
41-
42-
@Override
43-
public void close() {
44-
this.executor.shutdown();
45-
}
4646
}

dd-smoke-tests/concurrent/java-21/src/main/java/datadog/smoketest/concurrent/VirtualThreadSubmitCallableCalculator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public long computeFibonacci(int n) throws ExecutionException, InterruptedExcept
2020
return this.executor.submit(task).get();
2121
}
2222

23+
@Override
24+
public void close() {
25+
this.executor.shutdown();
26+
}
27+
2328
public class FibonacciSubmitTask implements Callable<Long> {
2429
private final long n;
2530

@@ -39,9 +44,4 @@ public Long call() throws ExecutionException, InterruptedException {
3944
return future1.get() + future2.get();
4045
}
4146
}
42-
43-
@Override
44-
public void close() {
45-
this.executor.shutdown();
46-
}
4747
}

dd-smoke-tests/concurrent/java-21/src/main/java/datadog/smoketest/concurrent/VirtualThreadSubmitRunnableCalculator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public long computeFibonacci(int n) throws ExecutionException, InterruptedExcept
2020
return task.result.get();
2121
}
2222

23+
@Override
24+
public void close() {
25+
this.executor.shutdown();
26+
}
27+
2328
public class FibonacciSubmitTask implements Runnable {
2429
private final long n;
2530
private final CompletableFuture<Long> result;
@@ -46,9 +51,4 @@ public void run() {
4651
}
4752
}
4853
}
49-
50-
@Override
51-
public void close() {
52-
this.executor.shutdown();
53-
}
5454
}

0 commit comments

Comments
 (0)