|
GridGain 3.6.0e
Enterprise Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Documented @Retention(value=RUNTIME) @Target(value=TYPE) public @interface GridTaskSpis
This annotation allows task to specify what SPIs it wants to use.
Starting with GridGain 2.1 you can start multiple instances
of GridTopologySpi, GridLoadBalancingSpi,
GridFailoverSpi, and GridCheckpointSpi. If you do that,
you need to tell a task which SPI to use (by default it will use the fist
SPI in the list).
Node1 and Node2.
Let's also assume that you configure Node1 to belong to SegmentA
and Node2 to belong to SegmentB. Here is a sample configuration
for Node1
<bean id="grid.cfg" class="org.gridgain.grid.GridConfigurationAdapter" scope="singleton">
<property name="userAttributes">
<map>
<entry key="segment" value="A"/>
</map>
</property>
</bean>
Node2 configuration looks similar to Node1 with 'segment' attribute
set to 'B'.
<bean id="grid.cfg" class="org.gridgain.grid.GridConfigurationAdapter" scope="singleton">
<property name="userAttributes">
<map>
<entry key="segment" value="B"/>
</map>
</property>
</bean>
Now, if you have Task1 and Task2 starting from some master node NodeM,
you can easily configure Task1 to only run on SegmentA and Task2 to
only run on SegmentB. Here is how configuration on master node NodeM would
look like:
<bean id="grid.cfg" class="org.gridgain.grid.GridConfigurationAdapter" scope="singleton">
<!--
Topology SPIs. We have two named SPIs: One picks up nodes
that have attribute "segment" set to "A" and another one sees
nodes that have attribute "segment" set to "B".
-->
<property name="topologySpi">
<list>
<bean class="org.gridgain.grid.spi.topology.nodefilter.GridNodeFilterTopologySpi">
<property name="name" value="topologyA"/>
<property name="filter">
<bean class="org.gridgain.grid.lang.GridJexlPredicate2">
<property name="expression" value="elem1.attributes().get('segment') == 'A'"/>
</bean>
</property>
</bean>
<bean class="org.gridgain.grid.spi.topology.nodefilter.GridNodeFilterTopologySpi">
<property name="name" value="topologyB"/>
<property name="filter">
<bean class="org.gridgain.grid.lang.GridJexlPredicate2">
<property name="expression" value="elem1.attributes().get('segment') == 'B'"/>
</bean>
</property>
</bean>
</list>
</property>
</bean>
Then your Task1 and Task2 would look as follows (note the @GridTaskSpis
annotation).
...
@GridTaskSpis(topologySpi="topologyA")
public class GridSegmentATask extends GridTaskSplitAdapter<String, Integer> {
// Task class body.
}
...
and
@GridTaskSpis(topologySpi="topologyB")
...
public class GridSegmentBTask extends GridTaskSplitAdapter<String, Integer> {
// Task class body.
}
...
| Wiki | |
| Forum |

| Optional Element Summary | |
|---|---|
String |
checkpointSpi
Optional checkpoint SPI name. |
String |
failoverSpi
Optional failover SPI name. |
String |
loadBalancingSpi
Optional load balancing SPI name. |
String |
topologySpi
Optional topology SPI name. |
public abstract String loadBalancingSpi
GridSpi.getName() parameter in grid configuration.
public abstract String failoverSpi
GridSpi.getName() parameter in grid configuration.
public abstract String topologySpi
GridSpi.getName() parameter in grid configuration.
public abstract String checkpointSpi
GridSpi.getName() parameter in grid configuration.
|
GridGain 3.6.0e
Enterprise Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
|
GridGain - Real Time Big Data
|
|
|