Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setFailureDetectionTimeout()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setFailureDetectionTimeout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TcpCommunicationSpiFaultyClientTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setFailureDetectionTimeout(failureDetectionTimeout);

    TestCommunicationSpi spi = new TestCommunicationSpi();

    if (connectTimeout != -1) {
        spi.setConnectTimeout(connectTimeout);
        spi.setMaxConnectTimeout(maxConnectTimeout);
        spi.setReconnectCount(reconnectCnt);
    }

    spi.setIdleConnectionTimeout(100);
    spi.setSharedMemoryPort(-1);

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setClientReconnectDisabled(true);

    cfg.setCommunicationSpi(spi);

    return cfg;
}
 
Example 2
Source File: CacheContinuousQueryFilterDeploymentFailedTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    // Failure detection timeout > P2P class loading timeout which is set as network timeout.
    cfg.setFailureDetectionTimeout(cfg.getNetworkTimeout() * 2);

    ((TestTcpDiscoverySpi)cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() {
        @Override public void afterDiscovery(DiscoveryCustomMessage customMsg) {
            if (customMsg instanceof StopRoutineDiscoveryMessage)
                stopRoutineLatch.countDown();
        }
    });

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    return cfg;
}
 
Example 3
Source File: ZookeeperDiscoveryClientDisconnectTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    // we reduce fealure detection tp speedup failure detection on catch(Exception) clause in createTcpClient().
    cfg.setFailureDetectionTimeout(2000);
    cfg.setClientFailureDetectionTimeout(2000);

    return cfg;
}
 
Example 4
Source File: TcpCommunicationSpiFreezingClientTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setFailureDetectionTimeout(120000);
    cfg.setClientFailureDetectionTimeout(120000);

    TcpCommunicationSpi spi = new TcpCommunicationSpi();

    spi.setConnectTimeout(3000);
    spi.setMaxConnectTimeout(6000);
    spi.setReconnectCount(3);
    spi.setIdleConnectionTimeout(100);
    spi.setSharedMemoryPort(-1);

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

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setCommunicationSpi(spi);
    cfg.setDiscoverySpi(discoSpi);

    cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME).setWriteSynchronizationMode(FULL_SYNC).
        setCacheMode(PARTITIONED).setAtomicityMode(ATOMIC));

    return cfg;
}
 
Example 5
Source File: GridCacheQueueClientDisconnectTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setClientReconnectDisabled(false);

    cfg.setFailureDetectionTimeout(FAILURE_DETECTION_TIMEOUT);
    cfg.setClientFailureDetectionTimeout(FAILURE_DETECTION_TIMEOUT);

    return cfg;
}
 
Example 6
Source File: IgniteDiscoveryMassiveNodeFailTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    FailDiscoverySpi disco = new FailDiscoverySpi();

    disco.setIpFinder(LOCAL_IP_FINDER);

    cfg.setDiscoverySpi(disco);

    disco.setConnectionRecoveryTimeout(timeout);

    cfg.setFailureDetectionTimeout(FAILURE_DETECTION_TIMEOUT);

    return cfg;
}
 
Example 7
Source File: TcpDiscoveryNodeJoinAndFailureTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpDiscoverySpi spi = specialSpi != null ? specialSpi : new TcpDiscoverySpi();

    if (usePortFromNodeName)
        spi.setLocalPort(Integer.parseInt(igniteInstanceName.split("-")[1]));

    if (specialIpFinder0 != null && igniteInstanceName.equals(NODE_WITH_PORT_ID_2))
        spi.setIpFinder(specialIpFinder0);
    else if (specialIpFinder1 != null && igniteInstanceName.equals(NODE_WITH_PORT_ID_3))
        spi.setIpFinder(specialIpFinder1);
    else
        spi.setIpFinder(sharedStaticIpFinder);

    spi.setNetworkTimeout(2500);

    spi.setIpFinderCleanFrequency(5000);

    spi.setJoinTimeout(5000);

    spi.setConnectionRecoveryTimeout(0);

    cfg.setDiscoverySpi(spi);

    cfg.setFailureDetectionTimeout(7500);

    if (nodeId != null && igniteInstanceName.equals(NODE_WITH_PORT_ID_2))
        cfg.setNodeId(nodeId);

    return cfg;
}
 
Example 8
Source File: TcpCommunicationSpiSkipMessageSendTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (!igniteInstanceName.contains("client")) {
        FifoQueueCollisionSpi collisionSpi = new FifoQueueCollisionSpi();

        collisionSpi.setParallelJobsNumber(1);

        cfg.setCollisionSpi(collisionSpi);
    }

    cfg.setFailureDetectionTimeout(FAILURE_DETECTION_TIMEOUT);

    cfg.setSegmentationPolicy(SegmentationPolicy.NOOP);

    TcpCommunicationSpi commSpi = new CustomCommunicationSpi();

    cfg.setCommunicationSpi(commSpi);

    TcpDiscoverySpi discoSpi = new CustomDiscoverySpi();

    discoSpi.setIpFinder(LOCAL_IP_FINDER);
    discoSpi.setJoinTimeout(JOIN_TIMEOUT);

    cfg.setDiscoverySpi(discoSpi);

    return cfg;
}
 
Example 9
Source File: TcpCommunicationSpiDropNodesTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setFailureDetectionTimeout(1000);

    TestCommunicationSpi spi = new TestCommunicationSpi();

    spi.setIdleConnectionTimeout(100);
    spi.setSharedMemoryPort(-1);

    cfg.setCommunicationSpi(spi);

    return cfg;
}
 
Example 10
Source File: IgniteWalRecoveryTest.java    From ignite with Apache License 2.0 2 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    CacheConfiguration<Integer, IndexedObject> ccfg = renamed ?
        new CacheConfiguration<>(RENAMED_CACHE_NAME) : new CacheConfiguration<>(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
    ccfg.setNodeFilter(new RemoteNodeFilter());
    ccfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Integer, IndexedObject> locCcfg = new CacheConfiguration<>(LOC_CACHE_NAME);
    locCcfg.setCacheMode(CacheMode.LOCAL);
    locCcfg.setIndexedTypes(Integer.class, IndexedObject.class);

    CacheConfiguration<Object, Object> cfg1 = new CacheConfiguration<>("cache1")
        .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
        .setAffinity(new RendezvousAffinityFunction(false, 32))
        .setCacheMode(CacheMode.PARTITIONED)
        .setRebalanceMode(CacheRebalanceMode.SYNC)
        .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
        .setBackups(0);

    CacheConfiguration<Object, Object> cfg2 = new CacheConfiguration<>(cfg1).setName("cache2").setRebalanceOrder(10);

    cfg.setCacheConfiguration(ccfg, locCcfg, cfg1, cfg2);

    DataStorageConfiguration dbCfg = new DataStorageConfiguration();

    dbCfg.setPageSize(4 * 1024);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(256L * 1024 * 1024);
    memPlcCfg.setMaxSize(256L * 1024 * 1024);
    memPlcCfg.setPersistenceEnabled(true);

    dbCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    dbCfg.setWalRecordIteratorBufferSize(1024 * 1024);

    dbCfg.setWalHistorySize(2);

    if (logOnly)
        dbCfg.setWalMode(WALMode.LOG_ONLY);

    if (walSegmentSize != 0)
        dbCfg.setWalSegmentSize(walSegmentSize);

    dbCfg.setWalSegments(walSegments);

    dbCfg.setWalPageCompression(walPageCompression);

    dbCfg.setCheckpointFrequency(checkpointFrequency);

    cfg.setDataStorageConfiguration(dbCfg);

    BinaryConfiguration binCfg = new BinaryConfiguration();

    binCfg.setCompactFooter(false);

    cfg.setBinaryConfiguration(binCfg);

    if (!getTestIgniteInstanceName(0).equals(gridName))
        cfg.setUserAttributes(F.asMap(HAS_CACHE, true));

    if (customFailureDetectionTimeout > 0)
        cfg.setFailureDetectionTimeout(customFailureDetectionTimeout);

    return cfg;
}