use of org.agrona.collections.LongIterator in project angler by LMAX-Exchange.
the class MonitoredSockets method purgeEntriesOlderThan.
public void purgeEntriesOlderThan(final long latestUpdateCount) {
keysForRemoval.clear();
final Long2ObjectHashMap<T>.KeyIterator iterator = monitoredSocketInstances.keySet().iterator();
while (iterator.hasNext()) {
final long key = iterator.nextLong();
if (monitoredSocketInstances.get(key).getUpdateCount() != latestUpdateCount) {
keysForRemoval.add(key);
}
}
final LongIterator keyIterator = keysForRemoval.iterator();
while (keyIterator.hasNext()) {
final long key = keyIterator.nextValue();
final T staleEntry = monitoredSocketInstances.remove(key);
staleEntry.describeTo(socketDescriptor);
lifecycleListener.socketMonitoringStopped(socketDescriptor.getAddress(), socketDescriptor.getPort(), socketDescriptor.getInode());
}
}
Aggregations