Skip to content

Commit 5d2d863

Browse files
committed
Fix variable names
1 parent 71fb9ef commit 5d2d863

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.time.Duration;
44
import java.util.List;
5-
import java.util.Optional;
65
import java.util.concurrent.Executor;
76
import java.util.concurrent.ScheduledExecutorService;
87
import java.util.concurrent.ThreadFactory;
@@ -77,31 +76,31 @@ private static Runnable createShutdownTask(ThreadPoolConfig threadPoolConfig, En
7776
@Override
7877
public void run() {
7978
executor.shutdown();
80-
final Duration shutdownTimeout = threadPoolConfig.shutdownTimeout();
81-
final Optional<Duration> optionalInterval = threadPoolConfig.shutdownCheckInterval();
82-
final long shutdownRemaining = shutdownTimeout.toNanos();
83-
long remaining = shutdownRemaining;
84-
final long interval = optionalInterval.orElse(Duration.ofNanos(Long.MAX_VALUE)).toNanos();
85-
long intervalRemaining = interval;
86-
final long interrupt = threadPoolConfig.shutdownInterrupt().toNanos();
87-
long interruptRemaining = interrupt;
79+
final long configShutdownTimeout = threadPoolConfig.shutdownTimeout().toNanos();
80+
final long configShutdownInterrupt = threadPoolConfig.shutdownInterrupt().toNanos();
81+
final long configShutdownCheckInterval = threadPoolConfig.shutdownCheckInterval()
82+
.orElse(Duration.ofNanos(Long.MAX_VALUE)).toNanos();
83+
long shutdownTimeout = configShutdownTimeout;
84+
long shutdownInterrupt = configShutdownInterrupt;
85+
long shutdownCheckInterval = configShutdownCheckInterval;
8886

8987
long start = System.nanoTime();
9088
int loop = 1;
9189
for (;;) {
9290
// This log can be very useful when debugging problems
93-
log.debugf("loop: %s, remaining: %s, intervalRemaining: %s, interruptRemaining: %s", loop++, remaining,
94-
intervalRemaining, interruptRemaining);
91+
log.debugf("loop: %s, shutdownTimeout: %s, shutdownCheckInterval: %s, shutdownInterrupt: %s", loop++,
92+
shutdownTimeout, shutdownCheckInterval, shutdownInterrupt);
9593
try {
96-
if (!executor.awaitTermination(Math.min(remaining, intervalRemaining), TimeUnit.NANOSECONDS)) {
94+
if (!executor.awaitTermination(Math.min(shutdownTimeout, shutdownCheckInterval),
95+
TimeUnit.NANOSECONDS)) {
9796
long elapsed = System.nanoTime() - start;
98-
intervalRemaining -= elapsed;
99-
remaining = shutdownRemaining - elapsed;
100-
interruptRemaining = interrupt - elapsed;
101-
if (interruptRemaining <= 0) {
97+
shutdownTimeout = configShutdownTimeout - elapsed;
98+
shutdownInterrupt = configShutdownInterrupt - elapsed;
99+
shutdownCheckInterval = configShutdownCheckInterval - elapsed;
100+
if (shutdownInterrupt <= 0) {
102101
executor.shutdown(true);
103102
}
104-
if (remaining <= 0) {
103+
if (shutdownTimeout <= 0) {
105104
// done waiting
106105
final List<Runnable> runnables = executor.shutdownNow();
107106
if (!runnables.isEmpty()) {
@@ -113,8 +112,8 @@ public void run() {
113112
}
114113
break;
115114
}
116-
if (intervalRemaining <= 0) {
117-
intervalRemaining = interval;
115+
if (shutdownCheckInterval <= 0) {
116+
shutdownCheckInterval = configShutdownCheckInterval;
118117
// do some probing
119118
final int queueSize = executor.getQueueSize();
120119
final Thread[] runningThreads = executor.getRunningThreads();

0 commit comments

Comments
 (0)