/** {@inheritDoc} */
  @Override
  protected GridCacheConfiguration cacheConfiguration(String gridName) throws Exception {
    GridCacheConfiguration cfg = super.cacheConfiguration(gridName);

    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    cfg.setWriteSynchronizationMode(FULL_SYNC);

    return cfg;
  }
  /** {@inheritDoc} */
  @Override
  protected GridConfiguration getConfiguration(String gridName) throws Exception {
    GridConfiguration cfg = super.getConfiguration(gridName);

    if (cache) {
      GridCacheConfiguration cacheCfg = defaultCacheConfiguration();

      cacheCfg.setCacheMode(PARTITIONED);
      cacheCfg.setBackups(1);
      cacheCfg.setDistributionMode(nearOnly ? NEAR_ONLY : NEAR_PARTITIONED);
      cacheCfg.setPreloadMode(SYNC);
      cacheCfg.setAtomicityMode(TRANSACTIONAL);

      cfg.setCacheConfiguration(cacheCfg);
    }

    GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    return cfg;
  }