当前位置: 首页>>代码示例>>Java>>正文


Java PooledExecutionServiceConfigurationBuilder类代码示例

本文整理汇总了Java中org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder的典型用法代码示例。如果您正苦于以下问题:Java PooledExecutionServiceConfigurationBuilder类的具体用法?Java PooledExecutionServiceConfigurationBuilder怎么用?Java PooledExecutionServiceConfigurationBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PooledExecutionServiceConfigurationBuilder类属于org.ehcache.config.builders包,在下文中一共展示了PooledExecutionServiceConfigurationBuilder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EhCacheDao

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
/**
 * To initiate EhCacheDao with cacheManager and cache.
 * 
 * @param cacheName
 *            name of the cache.
 * @param cacheSize
 *            cache size.
 */
public EhCacheDao(final String cacheName, final long cacheSize) {

	setCacheManager(CacheManagerBuilder.newCacheManagerBuilder()
			.using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder() 
					.defaultPool("dflt", 0, 10)
			        .pool("defaultEventPool", 1, 3)
			        .pool("cache2Pool", 2, 2)
			        .build())
			    .withDefaultEventListenersThreadPool("defaultEventPool")
			.withCache(cacheName, CacheConfigurationBuilder
					.newCacheConfigurationBuilder(Long.class, byte[].class, ResourcePoolsBuilder.heap(cacheSize))
					.build())
			.build(true));

	setCache(cacheManager.getCache(cacheName, Long.class, byte[].class));
}
 
开发者ID:debmalya,项目名称:JavaVAD,代码行数:25,代码来源:EhCacheDao.java

示例2: dickPoolTest

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
public void dickPoolTest() {
    CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
            .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder()
                    .defaultPool("dflt", 0, 10).pool("defaultDiskPool", 1, 3).pool("cache2Pool", 2, 2).build())
            .with(new CacheManagerPersistenceConfiguration(new File(getStoragePath(), "myData")))
            .withDefaultDiskStoreThreadPool("defaultDiskPool")
            .withCache("cache1", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
                    ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES).disk(10L,
                            MemoryUnit.MB)))
            .withCache("cache2",
                    CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class,
                            String.class, ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES)
                                    .disk(10L, MemoryUnit.MB))
                            .withDiskStoreThreadPool("cache2Pool", 2))
            .build(true);

    Cache<Long, String> cache1 = cacheManager.getCache("cache1", Long.class, String.class);
    Cache<Long, String> cache2 = cacheManager.getCache("cache2", Long.class, String.class);

    cacheManager.close();
}
 
开发者ID:dzh,项目名称:jframe,代码行数:22,代码来源:TestThreadPool.java

示例3: eventsTest

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
public void eventsTest() {
    CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
            .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder()
                    .pool("defaultEventPool", 1, 3).pool("cache2Pool", 2, 2).build())
            .withDefaultEventListenersThreadPool(
                    "defaultEventPool")
            .withCache("cache1",
                    CacheConfigurationBuilder
                            .newCacheConfigurationBuilder(Long.class, String.class,
                                    ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
                            .add(CacheEventListenerConfigurationBuilder.newEventListenerConfiguration(
                                    new ListenerObject(), EventType.CREATED, EventType.UPDATED)))
            .withCache("cache2", CacheConfigurationBuilder
                    .newCacheConfigurationBuilder(Long.class, String.class,
                            ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
                    .add(CacheEventListenerConfigurationBuilder.newEventListenerConfiguration(new ListenerObject(),
                            EventType.CREATED, EventType.UPDATED))
                    .withEventListenersThreadPool("cache2Pool"))
            .build(true);

    Cache<Long, String> cache1 = cacheManager.getCache("cache1", Long.class, String.class);
    Cache<Long, String> cache2 = cacheManager.getCache("cache2", Long.class, String.class);

    cacheManager.close();
}
 
开发者ID:dzh,项目名称:jframe,代码行数:26,代码来源:TestThreadPool.java

示例4: diskStore

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
@Test
public void diskStore() throws Exception {
  // tag::diskStore[]
  CacheManager cacheManager
      = CacheManagerBuilder.newCacheManagerBuilder()
      .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder() // <1>
          .defaultPool("dflt", 0, 10)
          .pool("defaultDiskPool", 1, 3)
          .pool("cache2Pool", 2, 2)
          .build())
      .with(new CacheManagerPersistenceConfiguration(new File(getStoragePath(), "myData")))
      .withDefaultDiskStoreThreadPool("defaultDiskPool") // <2>
      .withCache("cache1",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
              ResourcePoolsBuilder.newResourcePoolsBuilder()
                  .heap(10, EntryUnit.ENTRIES)
                  .disk(10L, MemoryUnit.MB)))
      .withCache("cache2",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
              ResourcePoolsBuilder.newResourcePoolsBuilder()
                  .heap(10, EntryUnit.ENTRIES)
                  .disk(10L, MemoryUnit.MB))
              .withDiskStoreThreadPool("cache2Pool", 2)) // <3>
      .build(true);

  Cache<Long, String> cache1 =
      cacheManager.getCache("cache1", Long.class, String.class);
  Cache<Long, String> cache2 =
      cacheManager.getCache("cache2", Long.class, String.class);

  cacheManager.close();
  // end::diskStore[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:34,代码来源:ThreadPools.java

示例5: writeBehind

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
@Test
public void writeBehind() throws Exception {
  // tag::writeBehind[]
  CacheManager cacheManager
      = CacheManagerBuilder.newCacheManagerBuilder()
      .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder() // <1>
          .defaultPool("dflt", 0, 10)
          .pool("defaultWriteBehindPool", 1, 3)
          .pool("cache2Pool", 2, 2)
          .build())
      .withDefaultWriteBehindThreadPool("defaultWriteBehindPool") // <2>
      .withCache("cache1",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
                                        ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
              .withLoaderWriter(new SampleLoaderWriter<>(singletonMap(41L, "zero")))
              .add(WriteBehindConfigurationBuilder
                  .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3)
                  .queueSize(3)
                  .concurrencyLevel(1)))
      .withCache("cache2",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
                                        ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
              .withLoaderWriter(new SampleLoaderWriter<>(singletonMap(41L, "zero")))
              .add(WriteBehindConfigurationBuilder
                  .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3)
                  .useThreadPool("cache2Pool") // <3>
                  .queueSize(3)
                  .concurrencyLevel(2)))
      .build(true);

  Cache<Long, String> cache1 =
      cacheManager.getCache("cache1", Long.class, String.class);
  Cache<Long, String> cache2 =
      cacheManager.getCache("cache2", Long.class, String.class);

  cacheManager.close();
  // end::writeBehind[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:39,代码来源:ThreadPools.java

示例6: events

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
@Test
public void events() throws Exception {
  // tag::events[]
  CacheManager cacheManager
      = CacheManagerBuilder.newCacheManagerBuilder()
      .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder() // <1>
          .pool("defaultEventPool", 1, 3)
          .pool("cache2Pool", 2, 2)
          .build())
      .withDefaultEventListenersThreadPool("defaultEventPool") // <2>
      .withCache("cache1",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
                                        ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
              .add(CacheEventListenerConfigurationBuilder
                  .newEventListenerConfiguration(new ListenerObject(), EventType.CREATED, EventType.UPDATED)))
      .withCache("cache2",
          CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
                                        ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
              .add(CacheEventListenerConfigurationBuilder
                  .newEventListenerConfiguration(new ListenerObject(), EventType.CREATED, EventType.UPDATED))
              .withEventListenersThreadPool("cache2Pool")) // <3>
      .build(true);

  Cache<Long, String> cache1 =
      cacheManager.getCache("cache1", Long.class, String.class);
  Cache<Long, String> cache2 =
      cacheManager.getCache("cache2", Long.class, String.class);

  cacheManager.close();
  // end::events[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:32,代码来源:ThreadPools.java

示例7: writeBehindTest

import org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder; //导入依赖的package包/类
public void writeBehindTest() {
    CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
            .using(PooledExecutionServiceConfigurationBuilder.newPooledExecutionServiceConfigurationBuilder()
                    .defaultPool("dflt", 0, 10).pool("defaultWriteBehindPool", 1, 3).pool("cache2Pool", 2, 2)
                    .build())
            .withDefaultWriteBehindThreadPool("defaultWriteBehindPool")
            .withCache("cache1", CacheConfigurationBuilder
                    .newCacheConfigurationBuilder(Long.class, String.class,
                            ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
                    .withLoaderWriter(new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero")))
                    .add(WriteBehindConfigurationBuilder.newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3)
                            .queueSize(3).concurrencyLevel(1)))
            .withCache("cache2",
                    CacheConfigurationBuilder
                            .newCacheConfigurationBuilder(Long.class, String.class,
                                    ResourcePoolsBuilder.newResourcePoolsBuilder().heap(10, EntryUnit.ENTRIES))
                            .withLoaderWriter(new SampleLoaderWriter<Long, String>(singletonMap(41L, "zero")))
                            .add(WriteBehindConfigurationBuilder
                                    .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3)
                                    .useThreadPool("cache2Pool").queueSize(3).concurrencyLevel(2)))
            .build(true);

    Cache<Long, String> cache1 = cacheManager.getCache("cache1", Long.class, String.class);
    Cache<Long, String> cache2 = cacheManager.getCache("cache2", Long.class, String.class);

    cacheManager.close();
}
 
开发者ID:dzh,项目名称:jframe,代码行数:28,代码来源:TestThreadPool.java


注:本文中的org.ehcache.config.builders.PooledExecutionServiceConfigurationBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。