|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Documented @Retention(value=RUNTIME) @Target(value=TYPE) @Apache20LicenseCompatible 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).
<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.GridJexlNodeFilter">
<property name="expression" value="node.attributes['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.GridJexlNodeFilter">
<property name="expression" value="node.attributes['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> {
...
}
and
@GridTaskSpis(topologySpi="topologyB")
public class GridSegmentBTask extends GridTaskSplitAdapter<String, Integer> {
...
}
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

| 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 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|