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

    GridTcpDiscoverySpi disco = new GridTcpDiscoverySpi();

    disco.setIpFinder(new GridTcpDiscoveryVmIpFinder(true));

    c.setDiscoverySpi(disco);

    GridCacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(LOCAL);
    cc.setTxSerializableEnabled(true);

    cc.setDefaultTxTimeout(50);

    c.setCacheConfiguration(cc);

    c.setNetworkTimeout(1000);

    return c;
  }
コード例 #2
0
  /** {@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;
  }