use of org.wildfly.clustering.registry.RegistryListener in project wildfly by wildfly.
the class CacheRegistry method notifyListeners.
private void notifyListeners(Event.Type type, Map<K, V> entries) {
for (Map.Entry<RegistryListener<K, V>, ExecutorService> entry : this.listeners.entrySet()) {
RegistryListener<K, V> listener = entry.getKey();
ExecutorService executor = entry.getValue();
try {
executor.submit(() -> {
try {
switch(type) {
case CACHE_ENTRY_CREATED:
{
listener.addedEntries(entries);
break;
}
case CACHE_ENTRY_MODIFIED:
{
listener.updatedEntries(entries);
break;
}
case CACHE_ENTRY_REMOVED:
{
listener.removedEntries(entries);
break;
}
default:
{
throw new IllegalStateException(type.name());
}
}
} catch (Throwable e) {
ClusteringServerLogger.ROOT_LOGGER.registryListenerFailed(e, this.cache.getCacheManager().getCacheManagerConfiguration().cacheManagerName(), this.cache.getName(), type, entries);
}
});
} catch (RejectedExecutionException e) {
// Executor was shutdown
}
}
}
Aggregations