use of org.apache.ignite.spi.failover.FailoverContext 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.FailoverContext 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.FailoverContext 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;
}
Aggregations