@Override public boolean matches(InvalidationEvent event) { return _name.equals(event.getCache()); }
@Override public void invalidateAll(InvalidationScope scope) { invalidate(new InvalidationEvent(this, _name, scope)); }
@Override public void handleInvalidation(InvalidationEvent event) { InvalidationScope scope = event.getScope(); // First, flush every individual server in our local data center. if (scope == InvalidationScope.DATA_CENTER || scope == InvalidationScope.GLOBAL) { _invalidator.invalidateOtherServersInSameDataCenter(event); } // Next, flush remote data centers. if (scope == InvalidationScope.GLOBAL) { _invalidator.invalidateOtherDataCenters(event); } } }
@Override public void invalidate(InvalidationScope scope, String key) { invalidate(new InvalidationEvent(this, _name, scope, ImmutableList.of(key))); }
@Override public void handleInvalidation(InvalidationEvent event) { InvalidationScope scope = event.getScope(); // First, flush every individual server in our local data center. if (scope == InvalidationScope.DATA_CENTER || scope == InvalidationScope.GLOBAL) { _invalidator.invalidateOtherServersInSameDataCenter(event); } // Next, flush remote data centers. if (scope == InvalidationScope.GLOBAL) { _invalidator.invalidateOtherDataCenters(event); } } }
@Override public void invalidateAll(InvalidationScope scope, Collection<String> keys) { invalidate(new InvalidationEvent(this, _name, scope, keys)); }
@Override public boolean matches(InvalidationEvent event) { return _name.equals(event.getCache()); }
@Override public void invalidateAll(InvalidationScope scope) { invalidate(new InvalidationEvent(this, _name, scope)); }
private void notifyListeners(InvalidationEvent event) { // Call all the listeners. If any fail, propagate an exception so the caller discovers that some // listener has not been able to observe the new value. Throwable first = null; for (InvalidationListener listener : _listeners) { try { listener.handleInvalidation(event); } catch (Throwable t) { // Propagate the first exception, log the rest. if (first == null) { first = t; } else { _log.error("Exception handling cache invalidation event: {}", event.getCache(), t); } } } if (first != null) { throw Throwables.propagate(first); } }
@Override public void invalidateAll(InvalidationScope scope, Collection<String> keys) { invalidate(new InvalidationEvent(this, _name, scope, keys)); }
private void notifyListeners(InvalidationEvent event) { // Call all the listeners. If any fail, propagate an exception so the caller discovers that some // listener has not been able to observe the new value. Throwable first = null; for (InvalidationListener listener : _listeners) { try { listener.handleInvalidation(event); } catch (Throwable t) { // Propagate the first exception, log the rest. if (first == null) { first = t; } else { _log.error("Exception handling cache invalidation event: {}", event.getCache(), t); } } } if (first != null) { throw Throwables.propagate(first); } }
@Override public void invalidate(InvalidationScope scope, String key) { invalidate(new InvalidationEvent(this, _name, scope, ImmutableList.of(key))); }