Skip to content

Commit d272f96

Browse files
committed
race condition fix
1 parent 744bd12 commit d272f96

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ public void shouldAwaitActiveExchange() throws InterruptedException {
124124

125125
// Complete the exchange one second into the future
126126
final Duration exchangeDuration = Duration.ofSeconds(1);
127+
final long startTime = System.nanoTime(); // taking custom start time just in case
127128
completeExchange(exchangeDuration);
128129
log("Complete Exchange triggered");
129130

130131
// Time the shutdown sequence
131132
final Duration delayDuration = Duration.ofSeconds(Utils.adjustTimeout(20));
132133
log("Shutdown triggered with the delay of " + delayDuration.getSeconds());
133-
final long elapsed = timeShutdown(delayDuration);
134+
final long elapsed = timeShutdown(delayDuration, startTime);
134135
log("Shutdown complete");
135136

136137
// The shutdown should take at least as long as the exchange duration

0 commit comments

Comments
 (0)