/** * Returns one scheduled entry for the given {@code key} with no guaranteed ordering */ public ScheduledEntry<K, V> getByCompositeKey(K key) { Set<CompositeKey> candidateKeys = getCompositeKeys(key); ScheduledEntry<K, V> result = null; for (CompositeKey compositeKey : candidateKeys) { Integer second = secondsOfKeys.get(compositeKey); if (second != null) { Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries != null) { result = entries.get(compositeKey); } } } return result; }
/** * Returns one scheduled entry for the given {@code key} with no guaranteed ordering */ public ScheduledEntry<K, V> getByCompositeKey(K key) { Set<CompositeKey> candidateKeys = getCompositeKeys(key); ScheduledEntry<K, V> result = null; for (CompositeKey compositeKey : candidateKeys) { Integer second = secondsOfKeys.get(compositeKey); if (second != null) { Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries != null) { result = entries.get(compositeKey); } } } return result; }
private ScheduledEntry<K, V> cancelByCompositeKey(K key) { Set<CompositeKey> candidateKeys = getCompositeKeys(key); ScheduledEntry<K, V> result = null; for (CompositeKey compositeKey : candidateKeys) { Integer second = secondsOfKeys.remove(compositeKey); if (second == null) { continue; } Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries == null) { continue; } result = cancelAndCleanUpIfEmpty(second, entries, compositeKey); } return result; }
private ScheduledEntry<K, V> cancelByCompositeKey(K key) { Set<CompositeKey> candidateKeys = getCompositeKeys(key); ScheduledEntry<K, V> result = null; for (CompositeKey compositeKey : candidateKeys) { Integer second = secondsOfKeys.remove(compositeKey); if (second == null) { continue; } Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries == null) { continue; } result = cancelAndCleanUpIfEmpty(second, entries, compositeKey); } return result; }
private int cancelByCompositeKey(K key, ScheduledEntry<K, V> entryToRemove) { int cancelled = 0; for (CompositeKey compositeKey : getCompositeKeys(key)) { Integer second = secondsOfKeys.remove(compositeKey); if (second == null) { continue; } Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries == null) { continue; } if (cancelAndCleanUpIfEmpty(second, entries, compositeKey, entryToRemove)) { cancelled++; } } return cancelled; }
private int cancelByCompositeKey(K key, ScheduledEntry<K, V> entryToRemove) { int cancelled = 0; for (CompositeKey compositeKey : getCompositeKeys(key)) { Integer second = secondsOfKeys.remove(compositeKey); if (second == null) { continue; } Map<Object, ScheduledEntry<K, V>> entries = scheduledEntries.get(second); if (entries == null) { continue; } if (cancelAndCleanUpIfEmpty(second, entries, compositeKey, entryToRemove)) { cancelled++; } } return cancelled; }