Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,25 @@ public void awaitSuccess() {
throw new DockerClientException("Could not pull image: " + message);
}
}

/**
* Awaits the image to be pulled successful, with timeout
*
* @throws DockerClientException
* if the pull fails.
*/
public void awaitSuccess(long timeout, TimeUnit timeUnit) {
try {
awaitCompletion(timeout, timeUnit);
} catch (InterruptedException e) {
throw new DockerClientException("", e);
}

if (latestItem == null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hazim1093 why do you duplicate this code? Extract it to separate method, see BuildImageResultCallback for reference

throw new DockerClientException("Could not pull image");
} else if (!latestItem.isPullSuccessIndicated()) {
String message = (latestItem.getError() != null) ? latestItem.getError() : latestItem.getStatus();
throw new DockerClientException("Could not pull image: " + message);
}
}
}