use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridFailoverTaskWithPredicateSelfTest method getConfiguration.
/**
* {@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;
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridFailoverTopologySelfTest method getConfiguration.
/**
* {@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;
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class CacheAffinityCallSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
cfg.setFailoverSpi(failSpi);
// Do not configure cache on client.
if (igniteInstanceName.equals(getTestIgniteInstanceName(SRVS)))
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setForceServerMode(true);
else {
CacheConfiguration<?, ?> ccfg = defaultCacheConfiguration();
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setBackups(1);
cfg.setCacheConfiguration(ccfg);
}
return cfg;
}
use of org.apache.ignite.spi.failover.always.AlwaysFailoverSpi in project ignite by apache.
the class GridSessionJobFailoverSelfTest 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 IgniteCacheLockPartitionOnAffinityRunAbstractTest method getConfiguration.
/**
* {@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());
// TODO remove key configuration when https://issues.apache.org/jira/browse/IGNITE-5795 is fixed.
cfg.setCacheKeyConfiguration(new CacheKeyConfiguration(Person.Key.class.getName(), "orgId"));
AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
failSpi.setMaximumFailoverAttempts(MAX_FAILOVER_ATTEMPTS);
cfg.setFailoverSpi(failSpi);
return cfg;
}
Aggregations