private void updateInetAddresses() { long now = System.currentTimeMillis(); if (inetAddrCacheMS > 0 && _nextResolveTime < now) { _nextResolveTime = now + inetAddrCacheMS; for (UpdatableNode node : _all) { node.updateAddr(); } } }
private void closeAllNodes() { for (UpdatableNode node : _all) { try { node.close(); } catch (final Throwable t) { /* nada */ } } }
public synchronized void updateAll() { HashSet<UpdatableNode> seenNodes = new HashSet<UpdatableNode>(); // make a copy of _all, since UpdatableNode.update can add to it for (UpdatableNode node : new ArrayList<UpdatableNode>(_all)) { node.update(seenNodes); } if (seenNodes.size() > 0) { // not empty, means that at least 1 server gave node list // remove unused hosts Iterator<UpdatableNode> it = _all.iterator(); while (it.hasNext()) { if (!seenNodes.contains(it.next())) it.remove(); } } }