use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class FaultTolerance method always.
void always() {
// tag::always[]
AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
// Override maximum failover attempts.
failSpi.setMaximumFailoverAttempts(5);
// Override the default failover SPI.
IgniteConfiguration cfg = new IgniteConfiguration().setFailoverSpi(failSpi);
// Start a node.
Ignite ignite = Ignition.start(cfg);
// end::always[]
ignite.close();
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridFailoverSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setFailoverSpi(new AlwaysFailoverSpi());
return cfg;
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridFailoverCustomTopologySelfTest method getConfiguration.
/**
* {@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;
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridManagerStopSelfTest method testStopFailoverManager.
/**
* @throws Exception If failed.
*/
@Test
public void testStopFailoverManager() throws Exception {
AlwaysFailoverSpi spi = new AlwaysFailoverSpi();
injectLogger(spi);
ctx.config().setFailoverSpi(spi);
GridFailoverManager mgr = new GridFailoverManager(ctx);
mgr.stop(true);
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridCacheAffinityRoutingSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
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;
}
Aggregations