public void testEquals() { new EqualsTester() .addEqualityGroup( RemovalNotification.create("one", 1, RemovalCause.EXPLICIT), RemovalNotification.create("one", 1, RemovalCause.REPLACED)) .addEqualityGroup(RemovalNotification.create("1", 1, RemovalCause.EXPLICIT)) .addEqualityGroup(RemovalNotification.create("one", 2, RemovalCause.EXPLICIT)) .testEquals(); } }
@GuardedBy("this") void enqueueNotification( @Nullable K key, int hash, @Nullable V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }
@GuardedBy("this") void enqueueNotification( @NullableDecl K key, int hash, @NullableDecl V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }
@Override public void onRemoval(K key, V value, RemovalCause cause) { count.incrementAndGet(); lastNotification = RemovalNotification.create(key, value, com.google.common.cache.RemovalCause.valueOf(cause.name())); }
@GuardedBy("this") void enqueueNotification( @NullableDecl K key, int hash, @NullableDecl V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }
@Override public void onRemoval(K key, V value, RemovalCause cause) { add(RemovalNotification.create(key, value, com.google.common.cache.RemovalCause.valueOf(cause.name()))); } }
@GuardedBy("this") void enqueueNotification(@Nullable K key, int hash, ValueReference<K, V> valueReference, RemovalCause cause) { totalWeight -= valueReference.getWeight(); if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { V value = valueReference.get(); RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }
public void testEquals() { new EqualsTester() .addEqualityGroup( RemovalNotification.create("one", 1, RemovalCause.EXPLICIT), RemovalNotification.create("one", 1, RemovalCause.REPLACED)) .addEqualityGroup( RemovalNotification.create("1", 1, RemovalCause.EXPLICIT)) .addEqualityGroup( RemovalNotification.create("one", 2, RemovalCause.EXPLICIT)) .testEquals(); } }
@GuardedBy("this") void enqueueNotification( @NullableDecl K key, int hash, @NullableDecl V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }
@GuardedBy("this") void enqueueNotification( @Nullable K key, int hash, @Nullable V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); } if (map.removalNotificationQueue != DISCARDING_QUEUE) { RemovalNotification<K, V> notification = RemovalNotification.create(key, value, cause); map.removalNotificationQueue.offer(notification); } }