/** {@inheritDoc} */
  protected GridCacheConfiguration cacheConfiguration(String cacheName) {
    GridCacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setName(cacheName);

    if (META_CACHE_NAME.equals(cacheName)) cacheCfg.setCacheMode(REPLICATED);
    else {
      cacheCfg.setCacheMode(PARTITIONED);
      cacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY);

      cacheCfg.setBackups(0);
      cacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(CFG_GRP_SIZE));
    }

    cacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setQueryIndexEnabled(false);

    return cacheCfg;
  }
Ejemplo n.º 2
0
  /**
   * @param ccfg Cache configuration.
   * @return Data transfer object for preload configuration properties.
   */
  public static VisorPreloadConfig from(GridCacheConfiguration ccfg) {
    VisorPreloadConfig cfg = new VisorPreloadConfig();

    cfg.mode(ccfg.getPreloadMode());
    cfg.batchSize(ccfg.getPreloadBatchSize());
    cfg.threadPoolSize(ccfg.getPreloadThreadPoolSize());
    cfg.partitionedDelay(ccfg.getPreloadPartitionedDelay());
    cfg.throttle(ccfg.getPreloadThrottle());
    cfg.timeout(ccfg.getPreloadTimeout());

    return cfg;
  }