private void statsContainer(String id, URI clusterUri, Statistics preStats) { if (this.isStopping()) { return; } if (isStopContainer(id)) { return; } schedule(() -> { CountDownLatch countDownLatch = new CountDownLatch(this.statsBatch); StatsContainerCallback statsCallback = null; try { statsCallback = dockerClient.statsCmd(id).exec(new StatsContainerCallback(this, clusterUri, id, countDownLatch, preStats)); } catch (com.github.dockerjava.api.exception.ConflictException | com.github.dockerjava.api.exception.NotFoundException e) { return; } try { countDownLatch.await(this.statsCallBackTimeout, TimeUnit.SECONDS); } catch (InterruptedException e) { } finally { try { statsCallback.close(); } catch (IOException e) { } statsContainer(id, clusterUri, statsCallback.getPreStat()); } }, this.statsPeriod, TimeUnit.SECONDS); }