/** See {@link CacheEntryListenerConfiguration#isSynchronous()}. */ public boolean isSynchronous() { return configuration.isSynchronous(); } }
/** * Constructs a {@link MutableCacheEntryListenerConfiguration} based on * another {@link CacheEntryListenerConfiguration}. * * @param configuration the {@link CacheEntryListenerConfiguration} */ public MutableCacheEntryListenerConfiguration(CacheEntryListenerConfiguration<K, V> configuration) { this.listenerFactory = configuration.getCacheEntryListenerFactory(); this.filterFactory = configuration.getCacheEntryEventFilterFactory(); this.isOldValueRequired = configuration.isOldValueRequired(); this.isSynchronous = configuration.isSynchronous(); }
private void registerEhcacheListeners(CacheEntryListenerConfiguration<K, V> config, ListenerResources<K, V> resources) { final boolean synchronous = config.isSynchronous(); final EventOrdering ordering = synchronous ? EventOrdering.ORDERED : EventOrdering.UNORDERED; final EventFiring firing = synchronous ? EventFiring.SYNCHRONOUS : EventFiring.ASYNCHRONOUS; final boolean requestsOld = config.isOldValueRequired(); for (EventListenerAdaptor<K, V> ehcacheListener : resources.getEhcacheListeners(this, requestsOld)) { ehCache.getRuntimeConfiguration().registerCacheEventListener(ehcacheListener, ordering, firing, EnumSet.of(ehcacheListener.getEhcacheEventType())); } }
static void checkListener(CaffeineConfiguration<?, ?> config) { CacheEntryListenerConfiguration<?, ?> listener = Iterables.getOnlyElement( config.getCacheEntryListenerConfigurations()); assertThat(listener.getCacheEntryListenerFactory().create(), instanceOf(TestCacheEntryListener.class)); assertThat(listener.getCacheEntryEventFilterFactory().create(), instanceOf(TestCacheEntryEventFilter.class)); assertThat(listener.isSynchronous(), is(true)); assertThat(listener.isOldValueRequired(), is(true)); }
final boolean sync = cacheEntryListenerConfiguration.isSynchronous();
final boolean sync = cacheEntryListenerConfiguration.isSynchronous();
rmtFilterFactory, cfg.isOldValueRequired(), cfg.isSynchronous(), false, false, jCacheFilter, cfg.isOldValueRequired(), cfg.isSynchronous(), false, false);
/** See {@link CacheEntryListenerConfiguration#isSynchronous()}. */ public boolean isSynchronous() { return configuration.isSynchronous(); } }
String removeListenerLocally(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.remove(cacheEntryListenerConfiguration); }
String getListenerIdLocal(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.get(cacheEntryListenerConfiguration); }
protected String getListenerIdLocal(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.get(cacheEntryListenerConfiguration); }
String removeListenerLocally(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.remove(cacheEntryListenerConfiguration); }
String getListenerIdLocal(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.get(cacheEntryListenerConfiguration); }
protected String getListenerIdLocal(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { ConcurrentMap<CacheEntryListenerConfiguration, String> regs; if (cacheEntryListenerConfiguration.isSynchronous()) { regs = syncListenerRegistrations; } else { regs = asyncListenerRegistrations; } return regs.get(cacheEntryListenerConfiguration); }
void addListenerLocally(String regId, CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { if (cacheEntryListenerConfiguration.isSynchronous()) { syncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } else { asyncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } }
void addListenerLocally(String regId, CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) { if (cacheEntryListenerConfiguration.isSynchronous()) { syncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } else { asyncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } }
protected void addListenerLocally(String regId, CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, CacheEventListenerAdaptor<K, V> adaptor) { if (cacheEntryListenerConfiguration.isSynchronous()) { syncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } else { asyncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } CacheEntryListener<K, V> entryListener = adaptor.getCacheEntryListener(); if (entryListener instanceof Closeable) { closeableListeners.putIfAbsent(regId, (Closeable) entryListener); } }
protected void addListenerLocally(String regId, CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, CacheEventListenerAdaptor<K, V> adaptor) { if (cacheEntryListenerConfiguration.isSynchronous()) { syncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } else { asyncListenerRegistrations.putIfAbsent(cacheEntryListenerConfiguration, regId); } CacheEntryListener<K, V> entryListener = adaptor.getCacheEntryListener(); if (entryListener instanceof Closeable) { closeableListeners.putIfAbsent(regId, (Closeable) entryListener); } }
/** * Constructs a {@link MutableCacheEntryListenerConfiguration} based on * another {@link CacheEntryListenerConfiguration}. * * @param configuration the {@link CacheEntryListenerConfiguration} */ public MutableCacheEntryListenerConfiguration(CacheEntryListenerConfiguration<K, V> configuration) { this.listenerFactory = configuration.getCacheEntryListenerFactory(); this.filterFactory = configuration.getCacheEntryEventFilterFactory(); this.isOldValueRequired = configuration.isOldValueRequired(); this.isSynchronous = configuration.isSynchronous(); }
private void registerEhcacheListeners(CacheEntryListenerConfiguration<K, V> config, ListenerResources<K, V> resources) { final boolean synchronous = config.isSynchronous(); final EventOrdering ordering = synchronous ? EventOrdering.ORDERED : EventOrdering.UNORDERED; final EventFiring firing = synchronous ? EventFiring.SYNCHRONOUS : EventFiring.ASYNCHRONOUS; final boolean requestsOld = config.isOldValueRequired(); for (EventListenerAdaptor<K, V> ehcacheListener : resources.getEhcacheListeners(this, requestsOld)) { ehCache.getRuntimeConfiguration().registerCacheEventListener(ehcacheListener, ordering, firing, EnumSet.of(ehcacheListener.getEhcacheEventType())); } }