/** {@inheritDoc} */
  @SuppressWarnings({"IfMayBeConditional"})
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    if (client()) cfg.setClientMode(true);

    cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));

    cfg.setCacheConfiguration();

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    cfg.setIncludeProperties();

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    cfg.setIncludeProperties();

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    cfg.setConnectorConfiguration(null);

    cfg.setPeerClassLoadingEnabled(true);

    if (useCache) {
      CacheConfiguration cc = defaultCacheConfiguration();

      cc.setCacheMode(PARTITIONED);

      cc.setNearConfiguration(null);
      cc.setWriteSynchronizationMode(FULL_SYNC);
      cc.setStartSize(ENTRY_CNT / GRID_CNT);
      cc.setSwapEnabled(false);

      cc.setBackups(1);

      cfg.setCacheSanityCheckEnabled(false);
      cfg.setCacheConfiguration(cc);
    } else cfg.setCacheConfiguration();

    return cfg;
  }