Java 类net.sf.ehcache.event.NotificationScope 实例源码

项目:jooby    文件:CacheConfigurationBuilderTest.java   
@SuppressWarnings("unchecked")
@Test
public void cacheEventListenerFactory() {
  Config config = ConfigFactory
      .empty()
      .withValue("cacheEventListenerFactory.class",
          fromAnyRef("my.Listener"))
      .withValue("cacheEventListenerFactory.listenFor",
          fromAnyRef("local"));

  CacheConfigurationBuilder builder = new CacheConfigurationBuilder("c1");
  CacheConfiguration cache = builder.build(config);

  List<CacheEventListenerFactoryConfiguration> listeners = cache
      .getCacheEventListenerConfigurations();
  assertEquals(1, listeners.size());
  assertEquals("my.Listener", listeners.get(0).getFullyQualifiedClassPath());
  assertEquals(NotificationScope.LOCAL, listeners.get(0).getListenFor());

}
项目:jooby    文件:CacheConfigurationBuilderTest.java   
@SuppressWarnings("unchecked")
@Test
public void cacheEventListenerFactories() {
  Config config = ConfigFactory
      .empty()
      .withValue("cacheEventListenerFactory.l1.class",
          fromAnyRef("my.Listener"))
      .withValue("cacheEventListenerFactory.l1.listenFor",
          fromAnyRef("local"));

  CacheConfigurationBuilder builder = new CacheConfigurationBuilder("c1");
  CacheConfiguration cache = builder.build(config);

  List<CacheEventListenerFactoryConfiguration> listeners = cache
      .getCacheEventListenerConfigurations();
  assertEquals(1, listeners.size());
  assertEquals("my.Listener", listeners.get(0).getFullyQualifiedClassPath());
  assertEquals(NotificationScope.LOCAL, listeners.get(0).getListenFor());

}
项目:firefly    文件:CacheEventWorker.java   
private void initCacheListener() {
    if (cache!=null) {
        if (cache instanceof EhcacheImpl) {
            Ehcache ehC= ((EhcacheImpl)cache).getEHcache();
            ehC.getCacheEventNotificationService().registerListener(new LoggingEventListener(), NotificationScope.ALL);
        }
    }

}
项目:OpenCyclos    文件:EhCacheCache.java   
@Override
public synchronized boolean addListener(final CacheListener listener) {
    EhCacheListenerAdapter ehCacheListener = new EhCacheListenerAdapter(listener);
    return ehcache.getCacheEventNotificationService().registerListener(ehCacheListener, NotificationScope.ALL);
}
项目:open-cyclos    文件:EhCacheCache.java   
@Override
public synchronized boolean addListener(final CacheListener listener) {
    EhCacheListenerAdapter ehCacheListener = new EhCacheListenerAdapter(listener);
    return ehcache.getCacheEventNotificationService().registerListener(ehCacheListener, NotificationScope.ALL);
}