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


Java IgniteConfiguration.setFailoverSpi方法代码示例

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


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

示例1: getConfiguration

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

    // Enables template with default test configuration
    cfg.setCacheConfiguration(F.concat(cfg.getCacheConfiguration(), cacheConfiguration(igniteInstanceName).setName("*")));

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

    cfg.setMarshaller(new BinaryMarshaller());

    AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
    failSpi.setMaximumFailoverAttempts(MAX_FAILOVER_ATTEMPTS);
    cfg.setFailoverSpi(failSpi);

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

示例2: 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

示例3: getConfiguration

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

    cfg.setFailoverSpi(new AlwaysFailoverSpi() {
        /** {@inheritDoc} */
        @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> grid) {
            ClusterNode failoverNode = super.failover(ctx, grid);

            if (failoverNode != null)
                routed.set(true);
            else
                routed.set(false);

            return failoverNode;
        }
    });

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

示例4: getConfiguration

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

    cfg.setFailoverSpi(new AlwaysFailoverSpi());

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

示例5: getConfiguration

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
    cfg.setFailoverSpi(failSpi);

    // Do not configure cache on client.
    if (igniteInstanceName.equals(getTestIgniteInstanceName(SRVS))) {
        cfg.setClientMode(true);

        spi.setForceServerMode(true);
    }
    else {
        CacheConfiguration ccfg = defaultCacheConfiguration();
        ccfg.setName(CACHE_NAME);
        ccfg.setCacheMode(PARTITIONED);
        ccfg.setBackups(1);

        cfg.setCacheConfiguration(ccfg);
    }

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

示例6: getConfiguration

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(spi);

    AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
    failSpi.setMaximumFailoverAttempts(MAX_FAILOVER_ATTEMPTS);
    cfg.setFailoverSpi(failSpi);

    if (!igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT))) {
        // Default cache configuration.
        CacheConfiguration dfltCacheCfg = defaultCacheConfiguration();

        dfltCacheCfg.setCacheMode(PARTITIONED);
        dfltCacheCfg.setBackups(1);
        dfltCacheCfg.setWriteSynchronizationMode(FULL_SYNC);

        // Non-default cache configuration.
        CacheConfiguration namedCacheCfg = defaultCacheConfiguration();

        namedCacheCfg.setCacheMode(PARTITIONED);
        namedCacheCfg.setBackups(1);
        namedCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
        namedCacheCfg.setName(NON_DFLT_CACHE_NAME);

        cfg.setCacheConfiguration(dfltCacheCfg, namedCacheCfg);
    }
    else {
        // No cache should be configured for extra node.
        cfg.setCacheConfiguration();
    }

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

示例7: getConfiguration

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

    GridTestFailoverSpi fail1 = new GridTestFailoverSpi("fail2");
    GridTestFailoverSpi fail2 = new GridTestFailoverSpi("fail2");

    fail1.setName("fail1");
    fail2.setName("fail2");

    GridTestLoadBalancingSpi load1 = new GridTestLoadBalancingSpi("load2");
    GridTestLoadBalancingSpi load2 = new GridTestLoadBalancingSpi("load2");

    load1.setName("load1");
    load2.setName("load2");

    GridTestCheckpointSpi cp1 = new GridTestCheckpointSpi("cp2");
    GridTestCheckpointSpi cp2 = new GridTestCheckpointSpi("cp2");

    cp1.setName("cp1");
    cp2.setName("cp2");

    cfg.setFailoverSpi(fail1, fail2);
    cfg.setLoadBalancingSpi(load1, load2);
    cfg.setCheckpointSpi(cp1, cp2);

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

示例8: getConfiguration

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

    cfg.setFailoverSpi(new GridTestFailoverSpi());

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

示例9: 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

示例10: initializeDefaultSpi

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Initialize default SPI implementations.
 *
 * @param cfg Ignite configuration.
 */
private void initializeDefaultSpi(IgniteConfiguration cfg) {
    if (cfg.getDiscoverySpi() == null)
        cfg.setDiscoverySpi(new TcpDiscoverySpi());

    if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) {
        TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi();

        if (tcpDisco.getIpFinder() == null)
            tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());
    }

    if (cfg.getCommunicationSpi() == null)
        cfg.setCommunicationSpi(new TcpCommunicationSpi());

    if (cfg.getDeploymentSpi() == null)
        cfg.setDeploymentSpi(new LocalDeploymentSpi());

    if (cfg.getEventStorageSpi() == null)
        cfg.setEventStorageSpi(new NoopEventStorageSpi());

    if (cfg.getCheckpointSpi() == null)
        cfg.setCheckpointSpi(new NoopCheckpointSpi());

    if (cfg.getCollisionSpi() == null)
        cfg.setCollisionSpi(new NoopCollisionSpi());

    if (cfg.getFailoverSpi() == null)
        cfg.setFailoverSpi(new AlwaysFailoverSpi());

    if (cfg.getLoadBalancingSpi() == null)
        cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi());
    else {
        Collection<LoadBalancingSpi> spis = new ArrayList<>();

        boolean dfltLoadBalancingSpi = false;

        for (LoadBalancingSpi spi : cfg.getLoadBalancingSpi()) {
            spis.add(spi);

            if (!dfltLoadBalancingSpi && spi instanceof RoundRobinLoadBalancingSpi)
                dfltLoadBalancingSpi = true;
        }

        // Add default load balancing SPI for internal tasks.
        if (!dfltLoadBalancingSpi)
            spis.add(new RoundRobinLoadBalancingSpi());

        cfg.setLoadBalancingSpi(spis.toArray(new LoadBalancingSpi[spis.size()]));
    }

    if (cfg.getIndexingSpi() == null)
        cfg.setIndexingSpi(new NoopIndexingSpi());
}
 
开发者ID:apache,项目名称:ignite,代码行数:59,代码来源:IgnitionEx.java

示例11: getConfiguration

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

    cfg.setDeploymentMode(depMode);

    cfg.setFailoverSpi(new NeverFailoverSpi());

    cfg.setNetworkTimeout(10000);

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

示例12: getConfiguration

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

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

    cfg.setPeerClassLoadingEnabled(false);

    cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);

    TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();

    discoverySpi.setAckTimeout(60000);
    discoverySpi.setIpFinder(ipFinder);
    discoverySpi.setForceServerMode(true);

    cfg.setDiscoverySpi(discoverySpi);

    if (igniteInstanceName.startsWith("master")) {
        cfg.setClientMode(true);

        cfg.setUserAttributes(ImmutableMap.of("segment", "master"));

        // For sure.
        failoverSpi.setMaximumFailoverAttempts(100);

        cfg.setFailoverSpi(failoverSpi);
    }
    else if (igniteInstanceName.startsWith("worker")) {
        cfg.setUserAttributes(ImmutableMap.of("segment", "worker"));

        CacheConfiguration cacheCfg = defaultCacheConfiguration();
        cacheCfg.setName("partitioned");
        cacheCfg.setAtomicityMode(atomicityMode());
        cacheCfg.setCacheMode(PARTITIONED);

        cacheCfg.setBackups(backups);

        cacheCfg.setNearConfiguration(nearEnabled ? new NearCacheConfiguration() : null);

        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);


        cfg.setCacheConfiguration(cacheCfg);
    }
    else
        throw new IllegalStateException("Unexpected Ignite instance name: " + igniteInstanceName);

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


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