/** {@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;
  }
Пример #2
0
  /**
   * Configure node.
   *
   * @param gridIdx Grid name index.
   * @param client If {@code true} then start client node.
   * @return IgniteConfiguration
   */
  private static IgniteConfiguration igniteConfiguration(int gridIdx, boolean client) {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setGridName((client ? "demo-server-" : "demo-client-") + gridIdx);

    cfg.setLocalHost("127.0.0.1");

    cfg.setIncludeEventTypes(EVTS_DISCOVERY);

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

    ipFinder.setAddresses(Collections.singletonList("127.0.0.1:60900.." + (60900 + NODE_CNT - 1)));

    // Configure discovery SPI.
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setLocalPort(60900);

    discoSpi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(discoSpi);

    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);

    commSpi.setLocalPort(60800);

    cfg.setCommunicationSpi(commSpi);

    cfg.setGridLogger(new Log4JLogger(log));

    cfg.setMetricsLogFrequency(0);

    cfg.getConnectorConfiguration().setPort(60700);

    if (client) cfg.setClientMode(true);
    else
      cfg.setCacheConfiguration(
          cacheCountry(), cacheDepartment(), cacheEmployee(), cacheParking(), cacheCar());

    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;
  }