// This function will add elements in timeoutTargets boolean timeout() { timeoutTargets.clear(); for (Map.Entry<ActorRef, Boolean> probeEntry : probes.entrySet()) { if (!probeEntry.getValue()) { int timeoutTime = timeoutTimes.get(probeEntry.getKey()); ++timeoutTime; System.out.println("Timeout!!!!!!!!!!!!!!!!!!TimeoutTime: " + timeoutTime); if (timeoutTime >= reactionFactor) { timeoutTargets.offer(probeEntry.getKey()); timeoutTimes.put(probeEntry.getKey(), 0); // It's time to do split, we don't want the history } else timeoutTimes.put(probeEntry.getKey(), timeoutTime); } probeEntry.setValue(false); } ++currentId; // Probes with old id will be treated as timeout probe return !timeoutTargets.isEmpty(); }