|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gridgain.grid.spi.GridSpiAdapter
org.gridgain.grid.spi.topology.nodefilter.GridNodeFilterTopologySpi
@GridSpiInfo(author="GridGain Systems",
url="www.gridgain.org",
email="support@gridgain.com",
version="x.x")
public class GridNodeFilterTopologySpi
This class provides implementation for topology SPI based on GridNodeFilter.
The implementation returns nodes that are accepted by GridNodeFilter provided
in configuration. If no filters were provided, all nodes, local and remote,
will be included into topology.
This topology allows for fine grained node provisioning for grid task execution. Nodes
can be filtered based on any parameter available on GridNode. For example,
you can filter nodes based on operating system, number of CPU's, available heap memory,
average job execution time, current CPU load, any node attribute and about 50 more metrics
available in GridNodeMetrics. Take a look at the following
methods on GridNode interface which may be used for filtering:
GridNode.getPhysicalAddress() - in most cases this parameter represents the IP
address the node.
GridNode.getAttributes() - attributes attached to a grid node. Node
attributes are specified in grid configuration via GridConfiguration.getUserAttributes()
parameter. Note that all system and environment properties are automatically pre-set as
node attributes for every node.
GridNode.getMetrics()} - about 50 node metrics parameters that are periodically
updated, such as heap, CPU, job counts, average job execution times, etc...
GridJexlNodeFilter implementation which allows you
to conveniently filter nodes based on Apache JEXL expression language. Refer to
Apache JEXL documentation for specifics of
JEXL expression language. GridJexlNodeFilter allows for a fairly simple way to
provide complex SLA-based task topology specifications. For example, the configuration
examples below show how the SPI can be configured with GridJexlNodeFilter to
include all Windows XP nodes with more than one processor or core and that are not loaded
over 50%.
GridNodeFilterTopologySpi.setFilter(GridNodeFilter) - Node filter
that should be used for decision to accept node.
GridNodeFilterTopologySpi topSpi = new GridNodeFilterTopologySpi();
GridNodeFilter filter = new GridJexlNodeFilter(
"node.metrics.availableProcessors > 1 && " +
"node.metrics.averageCpuLoad < 0.5 && " +
"node.attributes['os.name'] == 'Windows XP'");
// Add filter.
topSpi.setFilter(filter);
GridConfigurationAdapter cfg = new GridConfigurationAdapter();
// Override topology SPI.
cfg.setTopologySpi(topSpi);
// Start grid.
GridFactory.start(cfg);
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true">
...
<property name="topologySpi">
<bean class="org.gridgain.grid.spi.topology.nodefilter.GridNodeFilterTopologySpi">
<property name="filter">
<bean class="org.gridgain.grid.GridJexlNodeFilter">
<property name="expression">
<value>
<![CDATA[node.metrics.availableProcessors > 1 &&
node.metrics.averageCpuLoad < 0.5 &&
node.attributes['os.name'] == 'Windows XP']]>
</value>
</property>
</bean>
</property>
</bean>
</property>
...
</bean>
Documentation
Email Support
Online Forums
Issue Tracking
Author: 2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0
![]() |
![]() |
| Constructor Summary | |
|---|---|
GridNodeFilterTopologySpi()
|
|
| Method Summary | |
|---|---|
GridNodeFilter |
getFilter()
Gets node filter for nodes to be included into topology. |
Collection<GridNode> |
getTopology(GridTaskSession ses,
Collection<GridNode> grid)
This method is called by GridGain right before calling GridTask.map(List, Object)
to obtain a topology for the task's split. |
void |
setFilter(GridNodeFilter filter)
Sets filter for nodes to be included into task topology. |
void |
spiStart(String gridName)
This method is called to start SPI. |
void |
spiStop()
This method is called to stop SPI. |
String |
toString()
|
| Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter |
|---|
assertParameter, configInfo, createSpiAttributeName, getAuthor, getConsistentAttributeNames, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setName, setSpiContext, startInfo, startStopwatch, stopInfo, unregisterMBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gridgain.grid.spi.GridSpi |
|---|
getName, getNodeAttributes, onContextDestroyed, onContextInitialized |
| Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean |
|---|
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion |
| Constructor Detail |
|---|
public GridNodeFilterTopologySpi()
| Method Detail |
|---|
public GridNodeFilter getFilter()
getFilter in interface GridNodeFilterTopologySpiMBean@GridSpiConfiguration(optional=true) public void setFilter(GridNodeFilter filter)
filter - Filter to use.GridJexlNodeFilter
public void spiStart(@Nullable
String gridName)
throws GridSpiException
spiStart in interface GridSpiGridSpiException - Throws in case of any error during SPI start.gridName - Name of grid instance this SPI is being started for
(null for default grid).
public void spiStop()
throws GridSpiException
spiStop in interface GridSpiGridSpiException - Thrown in case of any error during SPI stop.
public Collection<GridNode> getTopology(GridTaskSession ses,
Collection<GridNode> grid)
throws GridSpiException
GridTask.map(List, Object)
to obtain a topology for the task's split.
getTopology in interface GridTopologySpiGridSpiException - Thrown in case if topology cannot be obtained.ses - Current task's session. If implementation does not depend on task's
information it may ignore it.grid - Full set of all grid nodes.
public String toString()
toString in class Object
|
GridGain 2.1.0
Java API Specification |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved. |
|
|