当前位置: 首页>>代码示例>>Java>>正文


Java IgniteConfiguration.setNodeId方法代码示例

本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setNodeId方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setNodeId方法的具体用法?Java IgniteConfiguration.setNodeId怎么用?Java IgniteConfiguration.setNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.configuration.IgniteConfiguration的用法示例。


在下文中一共展示了IgniteConfiguration.setNodeId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configuration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteConfiguration configuration() {
    if (staticCfg != null)
        return staticCfg;

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setMarshaller(marshaller);
    cfg.setNodeId(nodeId);
    cfg.setMBeanServer(jmx);
    cfg.setIgniteHome(home);
    cfg.setLocalHost(locHost);

    try {
        cfg.setWorkDirectory(U.defaultWorkDirectory());
    }
    catch (IgniteCheckedException e) {
        throw new IgniteException("Failed to get default work directory.", e);
    }

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:IgniteMock.java

示例2: copyDefaultsFromSource

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param cfg Config.
 * @param srcCfg Source config.
 */
private static void copyDefaultsFromSource(IgniteConfiguration cfg, IgniteConfiguration srcCfg) {
    cfg.setIgniteInstanceName(srcCfg.getIgniteInstanceName());
    cfg.setGridLogger(srcCfg.getGridLogger());
    cfg.setNodeId(srcCfg.getNodeId());
    cfg.setIgniteHome(srcCfg.getIgniteHome());
    cfg.setMBeanServer(srcCfg.getMBeanServer());
    cfg.setMetricsLogFrequency(srcCfg.getMetricsLogFrequency());
    cfg.setConnectorConfiguration(srcCfg.getConnectorConfiguration());
    cfg.setCommunicationSpi(srcCfg.getCommunicationSpi());
    cfg.setNetworkTimeout(srcCfg.getNetworkTimeout());
    cfg.setDiscoverySpi(srcCfg.getDiscoverySpi());
    cfg.setCheckpointSpi(srcCfg.getCheckpointSpi());
    cfg.setIncludeEventTypes(srcCfg.getIncludeEventTypes());

    // Specials.
    ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
    cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:ConfigVariationsFactory.java

示例3: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setNodeId(null);

    cfg.setFailoverSpi(new AlwaysFailoverSpi() {
        /** {@inheritDoc} */
        @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
            failCnt.incrementAndGet();

            return super.failover(ctx, top);
        }
    });

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:GridFailoverCustomTopologySelfTest.java

示例4: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

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

    if (igniteInstanceName.matches(".*\\d")) {
        String idStr = UUID.randomUUID().toString();

        char[] chars = idStr.toCharArray();

        chars[chars.length - 3] = '0';
        chars[chars.length - 2] = '0';
        chars[chars.length - 1] = igniteInstanceName.charAt(igniteInstanceName.length() - 1);

        cfg.setNodeId(UUID.fromString(new String(chars)));
    }

    cfg.setCommunicationSpi(new TestTcpCommunicationSpi());

    CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setBackups(backupCnt);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    cfg.setCacheConfiguration(cacheCfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:34,代码来源:GridCachePartitionNotLoadedEventSelfTest.java

示例5: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setNodeId(null);

    cfg.setFailoverSpi(new AlwaysFailoverSpi() {
        /** Ignite instance. */
        @IgniteInstanceResource
        private Ignite ignite;

        /** {@inheritDoc} */
        @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> grid) {
            if (grid.size() != 1) {
                failed.set(true);

                error("Unexpected grid size [expected=1, grid=" + grid + ']');
            }

            UUID locNodeId = ignite.configuration().getNodeId();

            for (ClusterNode node : grid) {
                if (node.id().equals(locNodeId)) {
                    failed.set(true);

                    error("Grid shouldn't contain local node [localNodeId=" + locNodeId + ", grid=" + grid + ']');
                }
            }

            return super.failover(ctx, grid);
        }
    });

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:36,代码来源:GridFailoverTopologySelfTest.java

示例6: setNodeID

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private void setNodeID(IgniteConfiguration cfg) {
  UUID uuid = UUID.fromString(nodeID);
  cfg.setNodeId(uuid);
  cfg.setIgniteInstanceName(VERTX_NODE_PREFIX + uuid);
}
 
开发者ID:vert-x3,项目名称:vertx-ignite,代码行数:6,代码来源:IgniteClusterManager.java

示例7: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TestCommunicationSpi commSpi = new TestCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);

    cfg.setCommunicationSpi(commSpi);

    cfg.setPeerClassLoadingEnabled(false);

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setNetworkTimeout(5000);

    if (nodeId != null) {
        cfg.setNodeId(nodeId);

        nodeId = null;
    }

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setName(STATIC_CACHE);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:IgniteClientReconnectCacheTest.java


注:本文中的org.apache.ignite.configuration.IgniteConfiguration.setNodeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。