Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2015-12-07 12:00:46 +0000
committerJeff Johnston2015-12-08 15:29:37 +0000
commit58bdeb321eaa1e391f76492ee4ddc2007712309d (patch)
tree5cae2a7283d6b6cbfece8956b559ccefc13efa9f /containers/org.eclipse.linuxtools.docker.core/src/org/eclipse
parent05a1d3e072a121eca23f8bc64d11187065e711b2 (diff)
downloadorg.eclipse.linuxtools-58bdeb321eaa1e391f76492ee4ddc2007712309d.tar.gz
org.eclipse.linuxtools-58bdeb321eaa1e391f76492ee4ddc2007712309d.tar.xz
org.eclipse.linuxtools-58bdeb321eaa1e391f76492ee4ddc2007712309d.zip
Bug 483676 - Avoid logging multiple times when connection is down
Added an 'active' flag to track if connection was previously known as 'active' and log the error, unless the flag was already set to 'false', indicating that the connection was known as inactive/failed. Change-Id: Ic52462596e242fb81014de0eb0e2202070c94a1d Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/62093 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 46429f06524d3d6f2357b70c2afd3d524c197093) Reviewed-on: https://git.eclipse.org/r/62158
Diffstat (limited to 'containers/org.eclipse.linuxtools.docker.core/src/org/eclipse')
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index b266d2f248..ffa20b85f8 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -163,12 +163,12 @@ public class DockerConnection implements IDockerConnection, Closeable {
private Map<String, LogThread> loggingThreads = new HashMap<>();
- // private Set<String> printIds = new HashSet<String>();
-
// containers sorted by name
private List<IDockerContainer> containers;
// containers indexed by id
private Map<String, IDockerContainer> containersById;
+ // flag to indicate if the connection to the Docker daemon is active
+ private boolean active = false;
private boolean containersLoaded = false;
private List<IDockerImage> images;
private boolean imagesLoaded = false;
@@ -519,6 +519,7 @@ public class DockerConnection implements IDockerConnection, Closeable {
}
nativeContainers.addAll(client.listContainers(
DockerClient.ListContainersParam.allContainers()));
+ this.active = true;
}
// We have a list of containers. Now, we translate them to our own
// core format in case we decide to change the underlying engine
@@ -556,10 +557,13 @@ public class DockerConnection implements IDockerConnection, Closeable {
}
} catch (com.spotify.docker.client.DockerException
| InterruptedException e) {
- throw new DockerException(
- NLS.bind(Messages.List_Docker_Containers_Failure,
- this.getName()),
- e);
+ if (active) {
+ active = false;
+ throw new DockerException(
+ NLS.bind(Messages.List_Docker_Containers_Failure,
+ this.getName()),
+ e);
+ }
} finally {
// assign the new list of containers in a locked block of code to
// prevent concurrent access, even if an exception was raised.
@@ -1405,8 +1409,8 @@ public class DockerConnection implements IDockerConnection, Closeable {
}
}
- public void attachCommand(final String id,
- final InputStream in, final OutputStream out)
+ public void attachCommand(final String id, final InputStream in,
+ @SuppressWarnings("unused") final OutputStream out)
throws DockerException {
final byte[] prevCmd = new byte[1024];

Back to the top