コード例 #1
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    assertNotNull(clientNodes);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);

    boolean client = false;

    for (Integer clientIdx : clientNodes) {
      if (getTestGridName(clientIdx).equals(gridName)) {
        client = true;

        break;
      }
    }

    cfg.setClientMode(client);

    CacheConfiguration ccfg = new CacheConfiguration();

    ccfg.setBackups(0);
    ccfg.setRebalanceMode(SYNC);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    return cfg;
  }
コード例 #3
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    if (gridName.equals(getTestGridName(GRID_CNT - 1))) cfg.setClientMode(true);

    return cfg;
  }
コード例 #4
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    Collection<String> hostNames = Arrays.asList("h_1", "h_2", "h_3");

    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TcpDiscoverySpi disco = (TcpDiscoverySpi) cfg.getDiscoverySpi();

    cfg.setDiscoverySpi(new CustomHostsTcpDiscoverySpi(hostNames).setIpFinder(disco.getIpFinder()));

    return cfg;
  }
コード例 #5
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration iCfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) iCfg.getDiscoverySpi()).setIpFinder(ipFinder);
    ((TcpDiscoverySpi) iCfg.getDiscoverySpi()).setForceServerMode(true);

    if (getTestGridName(10).equals(gridName)) iCfg.setClientMode(true);

    CacheConfiguration<Integer, Integer> cachePCfg = new CacheConfiguration<>();

    cachePCfg.setName(CACHE_NAME_DHT_PARTITIONED);
    cachePCfg.setCacheMode(CacheMode.PARTITIONED);
    cachePCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cachePCfg.setBackups(1);
    cachePCfg.setRebalanceBatchSize(1);
    cachePCfg.setRebalanceBatchesPrefetchCount(1);
    cachePCfg.setRebalanceOrder(2);

    CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>();

    cachePCfg2.setName(CACHE_NAME_DHT_PARTITIONED_2);
    cachePCfg2.setCacheMode(CacheMode.PARTITIONED);
    cachePCfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    cachePCfg2.setBackups(1);
    cachePCfg2.setRebalanceOrder(2);
    // cachePCfg2.setRebalanceDelay(5000);//Known issue, possible deadlock in case of low priority
    // cache rebalancing delayed.

    CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>();

    cacheRCfg.setName(CACHE_NAME_DHT_REPLICATED);
    cacheRCfg.setCacheMode(CacheMode.REPLICATED);
    cacheRCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cacheRCfg.setRebalanceBatchSize(1);
    cacheRCfg.setRebalanceBatchesPrefetchCount(Integer.MAX_VALUE);
    ((TcpCommunicationSpi) iCfg.getCommunicationSpi())
        .setSharedMemoryPort(-1); // Shmem fail fix for Integer.MAX_VALUE.

    CacheConfiguration<Integer, Integer> cacheRCfg2 = new CacheConfiguration<>();

    cacheRCfg2.setName(CACHE_NAME_DHT_REPLICATED_2);
    cacheRCfg2.setCacheMode(CacheMode.REPLICATED);
    cacheRCfg2.setRebalanceMode(CacheRebalanceMode.SYNC);
    cacheRCfg2.setRebalanceOrder(4);

    iCfg.setCacheConfiguration(cachePCfg, cachePCfg2, cacheRCfg, cacheRCfg2);

    iCfg.setRebalanceThreadPoolSize(2);

    return iCfg;
  }
コード例 #6
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    if (gridName.equals(getTestGridName(GRID_CNT - 1))) cfg.setClientMode(true);

    cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());

    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);

    return cfg;
  }
コード例 #7
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);

    CacheConfiguration ccfg1 = new CacheConfiguration();

    ccfg1.setBackups(1);
    ccfg1.setName(CACHE1);
    ccfg1.setAffinity(new RendezvousAffinityFunction());
    ccfg1.setNodeFilter(new TestNodesFilter());

    CacheConfiguration ccfg2 = new CacheConfiguration();

    ccfg2.setBackups(1);
    ccfg2.setName(CACHE2);
    ccfg2.setAffinity(new RendezvousAffinityFunction());

    CacheConfiguration ccfg3 = new CacheConfiguration();

    ccfg3.setBackups(1);
    ccfg3.setName(CACHE3);
    ccfg3.setAffinity(new FairAffinityFunction());
    ccfg3.setNodeFilter(new TestNodesFilter());

    CacheConfiguration ccfg4 = new CacheConfiguration();

    ccfg4.setCacheMode(REPLICATED);
    ccfg4.setName(CACHE4);
    ccfg4.setNodeFilter(new TestNodesFilter());

    CacheConfiguration ccfg5 = new CacheConfiguration();

    ccfg5.setBackups(1);
    ccfg5.setName(CACHE5);

    if (gridName.equals(getTestGridName(NODE_CNT - 1))) {
      cfg.setClientMode(true);

      cfg.setCacheConfiguration(ccfg5);
    } else cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3, ccfg4);

    return cfg;
  }
コード例 #8
0
  /** @throws Exception If failed. */
  public void testRepeatingStart() throws Exception {
    try {
      IgniteConfiguration c = getConfiguration("1");

      startGrid("1", c);

      assert ((TcpDiscoverySpi) c.getDiscoverySpi()).started();

      try {
        startGrid("2", c);

        fail("Should not be able to start grid using same configuration instance.");
      } catch (Exception e) {
        info("Caught expected exception: " + e);
      }
    } finally {
      stopAllGrids();
    }
  }
コード例 #9
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setPeerClassLoadingEnabled(false);

    cfg.setDeploymentMode(depMode);

    if (initGar) {
      UriDeploymentSpi depSpi = new UriDeploymentSpi();

      depSpi.setUriList(Collections.singletonList(garFile));

      cfg.setDeploymentSpi(depSpi);
    }

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setHeartbeatFrequency(500);

    return cfg;
  }
コード例 #10
0
  /** {@inheritDoc} */
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    CacheConfiguration ccfg = new CacheConfiguration();
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

    QueryEntity person = new QueryEntity();
    person.setKeyType(TestKey.class.getName());
    person.setValueType(Person.class.getName());
    person.addQueryField("name", String.class.getName(), null);

    ccfg.setQueryEntities(Arrays.asList(person));

    cfg.setCacheConfiguration(ccfg);

    cfg.setMarshaller(null);

    return cfg;
  }