Source:
private List<IDockerContainer> listContainers() throws DockerException { final Map<String, IDockerContainer> updatedContainers = new HashMap<>(); try { final List<Container> nativeContainers = new ArrayList<>(); synchronized (clientLock) { if (client == null) { return Collections.emptyList(); } nativeContainers.addAll(client.listContainers( DockerClient.ListContainersParam.allContainers())); this.active = true; } for (Container nativeContainer : nativeContainers) { if (nativeContainer.status() .startsWith(Messages.Exited_specifier)) { synchronized (loggingThreads) { if (loggingThreads.containsKey(nativeContainer.id())) { loggingThreads.get(nativeContainer.id()) .requestStop(); loggingThreads.remove(nativeContainer.id()); } } } if (nativeContainer.status() .equals(Messages.Removal_In_Progress_specifier)) { continue; } if (this.containers != null && this.containersById .containsKey(nativeContainer.id())) { final IDockerContainer container = this.containersById .get(nativeContainer.id()); updatedContainers.put(nativeContainer.id(), new DockerContainer(this, nativeContainer, container.info())); } else { updatedContainers.put(nativeContainer.id(), new DockerContainer(this, nativeContainer)); } } } catch (com.spotify.docker.client.DockerException | InterruptedException e) { if (active) { setInactive(); } } finally { synchronized (containerLock) { this.containersById = updatedContainers; this.containers = sort(this.containersById.values(), new Comparator<IDockerContainer>() { @Override public int compare(final IDockerContainer container, final IDockerContainer otherContainer) { return container.name() .compareTo(otherContainer.name()); } }); this.containersLoaded = true; } } notifyContainerListeners(this.containers); return this.containers; }

Target:
private List<IDockerContainer> listContainers() throws DockerException { final Map<String, IDockerContainer> updatedContainers = new HashMap<>(); try { final List<Container> nativeContainers = new ArrayList<>(); synchronized (clientLock) { if (client == null) { return Collections.emptyList(); } nativeContainers.addAll(client.listContainers( DockerClient.ListContainersParam.allContainers())); this.active = true; } for (Container nativeContainer : nativeContainers) { if (nativeContainer.status() .startsWith(Messages.Exited_specifier)) { synchronized (loggingThreads) { if (loggingThreads.containsKey(nativeContainer.id())) { loggingThreads.get(nativeContainer.id()) .requestStop(); loggingThreads.remove(nativeContainer.id()); } } } if (nativeContainer.status() .equals(Messages.Removal_In_Progress_specifier)) { continue; } if (this.containers != null && this.containersById .containsKey(nativeContainer.id())) { final IDockerContainer container = this.containersById .get(nativeContainer.id()); updatedContainers.put(nativeContainer.id(), new DockerContainer(this, nativeContainer, container.info())); } else { updatedContainers.put(nativeContainer.id(), new DockerContainer(this, nativeContainer)); } } } catch (com.spotify.docker.client.DockerException | InterruptedException e) { if (active && e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof ProcessingException) { setInactive(); } else { throw new DockerException(e.getMessage()); } } finally { synchronized (containerLock) { this.containersById = updatedContainers; this.containers = sort(this.containersById.values(), new Comparator<IDockerContainer>() { @Override public int compare(final IDockerContainer container, final IDockerContainer otherContainer) { return container.name() .compareTo(otherContainer.name()); } }); this.containersLoaded = true; } } notifyContainerListeners(this.containers); return this.containers; }