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

    cfg.setCacheConfiguration(
        cacheConfiguration(META_CACHE_NAME), cacheConfiguration(DATA_CACHE_NAME));

    GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration();

    ggfsCfg.setMetaCacheName(META_CACHE_NAME);
    ggfsCfg.setDataCacheName(DATA_CACHE_NAME);
    ggfsCfg.setName("ggfs");
    ggfsCfg.setBlockSize(CFG_BLOCK_SIZE);
    ggfsCfg.setFragmentizerEnabled(true);

    cfg.setGgfsConfiguration(ggfsCfg);

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

    GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

    GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration();

    ggfsCfg.setDataCacheName("partitioned");
    ggfsCfg.setMetaCacheName("replicated");
    ggfsCfg.setName("ggfs");
    ggfsCfg.setManagementPort(GridGgfsConfiguration.DFLT_MGMT_PORT + cnt);

    ggfsCfg.setIpcEndpointConfiguration(
        new HashMap<String, String>() {
          {
            put("type", "shmem");
            put("port", String.valueOf(GridIpcSharedMemoryServerEndpoint.DFLT_IPC_PORT + cnt));
          }
        });

    ggfsCfg.setBlockSize(
        512 * 1024); // Together with group blocks mapper will yield 64M per node groups.

    cfg.setGgfsConfiguration(ggfsCfg);

    cfg.setCacheConfiguration(cacheConfiguration());

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    GridTcpCommunicationSpi commSpi = new GridTcpCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);

    cfg.setCommunicationSpi(commSpi);

    cnt++;

    return cfg;
  }