Skip to content

Commit

Permalink
Wait for request.abort to finish before calling is.close();
Browse files Browse the repository at this point in the history
  • Loading branch information
ncelerier authored and rohanKanojia committed Jul 29, 2021
1 parent 1dcc1a7 commit 76ac79f
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import io.fabric8.maven.docker.access.UrlBuilder;
import io.fabric8.maven.docker.access.util.RequestUtil;
import io.fabric8.maven.docker.util.TimestampFactory;
import io.fabric8.maven.docker.wait.WaitUtil;

import org.apache.commons.codec.binary.Hex;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
Expand Down Expand Up @@ -190,8 +192,15 @@ private void parseResponse(HttpResponse response) throws LogCallback.DoneExcepti
}
}
} finally {
if ((is != null) && (is.available() > 0)) {
// When finish() returns, request == null
while (request != null) {
WaitUtil.sleep(500);
}

if ((is != null)) {
System.out.println("*** Calling is.close...");
is.close();
System.out.println("*** Calling is.close: done.");
}
}
}
Expand All @@ -215,7 +224,9 @@ private HttpUriRequest getLogRequest(boolean follow) {
@Override
public void finish() {
if (request != null) {
System.out.println("*** Calling request.abort...");
request.abort();
System.out.println("*** Calling request.abort: done.");
request = null;
}
}
Expand Down

0 comments on commit 76ac79f

Please sign in to comment.