Skip to content

Commit 8d819ba

Browse files
author
Łukasz Jackiewicz
committed
Prevent deadlock on thread synchronization via CountDownLatch
1 parent 40d4fb2 commit 8d819ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/ContainerExecProc.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ public void kill() throws IOException, InterruptedException {
9797
public int join() throws IOException, InterruptedException {
9898
try {
9999
LOGGER.log(Level.FINEST, "Waiting for websocket to close on command finish ({0})", finished);
100-
finished.await();
101-
LOGGER.log(Level.FINEST, "Command is finished ({0})", finished);
100+
if (finished.await(1, TimeUnit.MINUTES)) {
101+
LOGGER.log(Level.FINEST, "Command is finished (the count reached zero)");
102+
} else {
103+
LOGGER.log(Level.FINEST, "Command is finished (waiting time elapsed before the count reached zero)");
104+
}
102105

103106
CompletableFuture<Integer> exitCodeFuture = watch.exitCode();
104107

0 commit comments

Comments
 (0)