Skip to content

Commit b73118e

Browse files
committed
Resolve timing issue around closing web socket streams
1 parent d3fd246 commit b73118e

File tree

1 file changed

+4
-1
lines changed
  • util/src/main/java/io/kubernetes/client

1 file changed

+4
-1
lines changed

util/src/main/java/io/kubernetes/client/Exec.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ public Process exec(
181181
private static class ExecProcess extends Process {
182182
private final WebSocketStreamHandler streamHandler;
183183
private volatile int statusCode;
184+
private volatile boolean isDestroyed = false;
184185

185186
public ExecProcess() throws IOException {
186187
this.statusCode = -1;
@@ -215,7 +216,8 @@ public void close() {
215216
ExecProcess.this.notifyAll();
216217
}
217218
}
218-
super.close();
219+
220+
if (isDestroyed) super.close();
219221
}
220222
};
221223
}
@@ -263,6 +265,7 @@ public int exitValue() {
263265

264266
@Override
265267
public void destroy() {
268+
isDestroyed = true;
266269
streamHandler.close();
267270
}
268271
}

0 commit comments

Comments
 (0)