Gridgain has failover spi mechanism for failure of jobs on nodes. However, we would like to configure a failure mechanism that throws exception even when once of the configured data nodes goes down.
How can we do this?
如果正在执行作业的节点出现故障,您是否试图阻止任务的故障转移并引发异常?(我不确定我是否理解正确,所以如果我错了,请纠正我)
如果我是对的,最简单的方法是配置NeverFailoverSpi
,如下所示:
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
...
<property name="failoverSpi">
<bean class="org.apache.ignite.spi.failover.never.NeverFailoverSpi"/>
</property>
</bean>
另一种选择是使用IgniteCompute.withAsyncNoFailover()
方法。如果您想为一小部分任务禁用故障转移,但仍对其他任务使用默认机制,这很有用。这是一个例子:
IgniteCompute compute = ignite.compute().withAsyncNoFailover();
// Tasks executed with this compute instance will never failover.
compute.execute(MyTask1.class, "arg");