Search in sources :

Example 1 with Long2ObjectHashMap

use of org.agrona.collections.Long2ObjectHashMap 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());
    }
}
Also used : Long2ObjectHashMap(org.agrona.collections.Long2ObjectHashMap) LongIterator(org.agrona.collections.LongIterator)

Aggregations

Long2ObjectHashMap (org.agrona.collections.Long2ObjectHashMap)1 LongIterator (org.agrona.collections.LongIterator)1