|
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.GridJexlNodeFilter
public class GridJexlNodeFilter
Implementation of GridNodeFilter based on
Apache JEXL expression
language. The expression will be compiled only once, at the creation
time, and all invocation will simply plugin the passed-in node into
the compiled expression.
Example below shows how JEXL node filter can be used to get grid nodes.
...
GridJexlNodeFilter filter = new GridJexlNodeFilter(
"node.metrics.availableProcessors > 1 && " +
"node.metrics.averageCpuLoad < 0.5 && " +
"node.attributes['os.name'] == 'Windows XP'"
);
Collection<GridNode> nodes = grid.getNodes(filter);
...
Together with GridNodeFilterTopologySpi
GridJexlNodeFilter allows for a fairly simple way to provide complex SLA-based
task topology specifications. For example, expression below shows 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%
<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 | |
|---|---|
GridJexlNodeFilter()
Creates filter. |
|
GridJexlNodeFilter(String expr)
Creates filter. |
|
| Method Summary | |
|---|---|
boolean |
accept(GridNode node)
Tests if a specified grid node should be accepted. |
String |
getExpression()
Gets expression. |
void |
setExpression(String expr)
Sets expression. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GridJexlNodeFilter()
public GridJexlNodeFilter(String expr)
throws GridRuntimeException
GridRuntimeException - If JEXL boolean expression failed.expr - JEXL boolean expression for filter.| Method Detail |
|---|
public String getExpression()
public void setExpression(String expr)
throws GridRuntimeException
GridRuntimeException - If JEXL boolean expression failed.expr - JEXL boolean expression.
public boolean accept(GridNode node)
throws GridRuntimeException
accept in interface GridNodeFilterGridRuntimeExceptionnode - Node to check.
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. |
|
|