Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2016-06-20 15:49:59 +0000
committerJeff Johnston2016-06-20 17:56:10 +0000
commitacae4c484160f0f8d4ee2a6e1a460001fe2fac71 (patch)
tree11f6a094c243198818c3bcb626c6159a920009e9
parent313fa25a6e0648cc3e318a93df227c1ffa3caf35 (diff)
downloadorg.eclipse.linuxtools-acae4c484160f0f8d4ee2a6e1a460001fe2fac71.tar.gz
org.eclipse.linuxtools-acae4c484160f0f8d4ee2a6e1a460001fe2fac71.tar.xz
org.eclipse.linuxtools-acae4c484160f0f8d4ee2a6e1a460001fe2fac71.zip
Bug 496380: Create Container progress dialog stuck on 100%.
Move the logic for waiting on a container to exit into a separate job so that the Create/Start progress job may finish. Also hide the 'Wait Container' job from users. Change-Id: I94579703b6f5beeab52a5f3d4fb0f8cb1f84f99c Reviewed-on: https://git.eclipse.org/r/75566 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CommandMessages.properties3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RunImageCommandHandler.java80
2 files changed, 48 insertions, 35 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CommandMessages.properties b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CommandMessages.properties
index 8f8fce17ce..a6767c0aff 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CommandMessages.properties
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/CommandMessages.properties
@@ -13,4 +13,5 @@ missing_connection=Missing connection
command.pullImage.failure.no_connection=Unable to pull an image: no connection was not found in the selection.
command.enableconnection=Opening connection to {0}
-command.enableconnection.failure=Failed to connect to {0} \ No newline at end of file
+command.enableconnection.failure=Failed to connect to {0}
+RunImageCommandHandler.waitContainer.label=Waiting For Container Exit
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RunImageCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RunImageCommandHandler.java
index 6e7d7ec54d..b7b13a4f16 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RunImageCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/RunImageCommandHandler.java
@@ -157,43 +157,55 @@ public class RunImageCommandHandler extends AbstractHandler {
containerConfig.image()),
e.getMessage()));
} finally {
+ final String tmpContainerId = containerId;
if (removeWhenExits) {
- try {
- if (containerId != null) {
- // Wait for the container to finish
- ((DockerConnection) connection)
- .waitForContainer(containerId);
- // Drain the logging thread before we remove the
- // container
- ((DockerConnection) connection)
- .stopLoggingThread(containerId);
- while (((DockerConnection) connection)
- .loggingStatus(
- containerId) == EnumDockerLoggingStatus.LOGGING_ACTIVE) {
- Thread.sleep(1000);
+ final Job waitContainerJob = new Job(
+ CommandMessages.getString(
+ "RunImageCommandHandler.waitContainer.label")) { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (tmpContainerId != null) {
+ // Wait for the container to finish
+ ((DockerConnection) connection)
+ .waitForContainer(tmpContainerId);
+ // Drain the logging thread before we remove the
+ // container
+ ((DockerConnection) connection)
+ .stopLoggingThread(tmpContainerId);
+ while (((DockerConnection) connection)
+ .loggingStatus(
+ tmpContainerId) == EnumDockerLoggingStatus.LOGGING_ACTIVE) {
+ Thread.sleep(1000);
+ }
+ }
+ } catch (DockerException | InterruptedException e) {
+ // ignore any errors in waiting for container or
+ // draining log
}
+ try {
+ // try and remove the container if it was created
+ if (tmpContainerId != null)
+ ((DockerConnection) connection)
+ .removeContainer(tmpContainerId);
+ } catch (DockerException | InterruptedException e) {
+ final String id = tmpContainerId;
+ Display.getDefault()
+ .syncExec(() -> MessageDialog.openError(
+ PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getShell(),
+ DVMessages.getFormattedString(
+ ERROR_REMOVING_CONTAINER,
+ id),
+ e.getMessage()));
+ }
+ return Status.OK_STATUS;
}
- } catch (DockerException | InterruptedException e) {
- // ignore any errors in waiting for container or
- // draining log
- }
- try {
- // try and remove the container if it was created
- if (containerId != null)
- ((DockerConnection) connection)
- .removeContainer(containerId);
- } catch (DockerException | InterruptedException e) {
- final String id = containerId;
- Display.getDefault()
- .syncExec(() -> MessageDialog.openError(
- PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(),
- DVMessages.getFormattedString(
- ERROR_REMOVING_CONTAINER,
- id),
- e.getMessage()));
- }
+ };
+ // Do not display this job in the UI
+ waitContainerJob.setSystem(true);
+ waitContainerJob.schedule();
}
monitor.done();

Back to the top