code: private void doHousekeeping() {
          logger.info("started");
          while (!shutdown) {
              try {
                  List<EarlyResponse> removedEarlyResponses = new ArrayList<>();
                  synchronized (responseMap) {
                      Iterator<List<EarlyResponse>> responseMapIterator = responseMap.values().iterator();
                      while (responseMapIterator.hasNext()) {
                          List<EarlyResponse> erList = responseMapIterator.next();
                          Iterator<EarlyResponse> erListIterator = erList.iterator();
                          while (erListIterator.hasNext()) {
                              EarlyResponse earlyResponse = erListIterator.next();
                              if (earlyResponse.ts < System.currentTimeMillis()) {
                                  responseMapIterator.remove();
                                  removedEarlyResponses.add(earlyResponse);
                              }
                          }
                          if (erList.isEmpty()) {
                              responseMapIterator.remove();
                          }
                      }
                  }
                  for (EarlyResponse er : removedEarlyResponses) {
                      logger.info("Removed early response with correlationId {} and responseId {}", er.response.getCorrelationId(), er.response.getResponseId());
                  }
                  removedEarlyResponses = null; // let the GC do its job :-)
                  Thread.sleep(checkInterval);
              } catch (InterruptedException e) {
                  // ignore
              }
          }
          logger.info("stopped");
      }
docs: Jetzt gibt es eine Map von Listen und man muss immer alles komplett Ueberpruefen - ggf. optimieren