|
GridGain 4.3.1e
Enterprise "Big Data" Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface GridNode
Interface representing a single grid node. Use GridNode.attribute(String) or
GridNode.metrics() to get static and dynamic information about remote nodes.
GridNode list, which includes all nodes within task topology, is provided
to GridTask.map(List, Object) method. You can also get a handle on
discovered nodes by calling any of the following methods:
Grid.localNode()GridProjection.remoteNodes(org.gridgain.grid.lang.GridPredicate[])GridProjection.nodes(org.gridgain.grid.lang.GridPredicate[])
GridConfiguration.getUserAttributes() method to initialize your custom
node attributes at startup. For example, to provide benchmark data about
every node from Spring XML configuration file, you would do the following:
<bean id="grid.cfg" class="org.gridgain.grid.GridConfigurationAdapter" scope="singleton">
...
<property name="userAttributes">
<map>
<entry key="grid.node.benchmark">
<bean class="org.gridgain.grid.benchmarks.GridLocalNodeBenchmark" init-method="start"/>
</entry>
</map>
</property>
...
</bean>
The system adds the following attributes automatically:
{@link System#getProperties()} - All system properties.{@link System#getenv(String)} - All environment properties.org.gridgain.build.ver - GridGain build version.org.gridgain.jit.name - Name of JIT compiler used.org.gridgain.net.itf.name - Name of network interface.org.gridgain.user.name - Operating system user name.org.gridgain.grid.name - Grid name (see Grid.name()).spiName.org.gridgain.spi.class - SPI implementation class for every SPI,
where spiName is the name of the SPI (see GridSpi.getName().
spiName.org.gridgain.spi.ver - SPI version for every SPI,
where spiName is the name of the SPI (see GridSpi.getName().
Note that all System and Environment properties for all nodes are automatically included
into node attributes. This gives you an ability to get any information specified
in System.getProperties() about any node. So for example, in order to print out
information about Operating System for all nodes you would do the following:
for (GridNode node : G.grid().nodes()) {
System.out.println("Operating system name: " + node.getAttribute("os.name"));
System.out.println("Operating system architecture: " + node.getAttribute("os.arch"));
System.out.println("Operating system version: " + node.getAttribute("os.version"));
}
This interface provide a system view on the node instance. All user-level APIs work with
GridRichNode interface that provides much more functionality and extends this
interface. Consult GridRichNode for more information.
GridNode.metrics()) are updated frequently for all nodes
and can be used to get dynamic information about a node. The frequency of update
is often directly related to the heartbeat exchange between nodes. So if, for example,
default GridMulticastDiscoverySpi is used,
the metrics data will be updated every 3 seconds by default.
Grid node metrics provide information about other nodes that can frequently change,
such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting
grid jobs, etc... This information can become useful during job collision resolution or
GridTask.map(List, Object) operation when jobs are assigned to remote nodes
for execution. For example, you can only pick nodes that don't have any jobs waiting
to be executed.
Local node metrics are registered as MBean and can be accessed from
any JMX management console. The simplest way is to use standard jconsole
that comes with JDK as it also provides ability to view any node parameter
as a graph.
GridRichNode

| Method Summary | ||
|---|---|---|
|
attribute(String name)
Gets a node attribute. |
|
Map<String,Object> |
attributes()
Gets all node attributes. |
|
Collection<String> |
externalAddresses()
Gets collection of IP addresses this node is known by externally outside of ths LAN. |
|
UUID |
id()
Gets globally unique node ID. |
|
Collection<String> |
internalAddresses()
Gets collection of IP addresses this node is known by internally on the same LAN. |
|
GridNodeMetrics |
metrics()
Gets metrics snapshot for this node. |
|
long |
order()
Node order within grid topology. |
|
| Methods inherited from interface org.gridgain.grid.GridMetadataAware |
|---|
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta |
| Method Detail |
|---|
UUID id()
<T> T attribute(String name)
GridConfiguration.getUserAttributes() method.
The system adds the following attributes automatically:
{@link System#getProperties()} - All system properties.{@link System#getenv(String)} - All environment properties.GridNodeAttributesNote that attributes cannot be changed at runtime.
T - Attribute Type.name - Attribute name. Note that attribute names starting with
org.gridgain are reserved for internal use.
null.GridNodeMetrics metrics()
GridNodeMetrics.getCurrentCpuLoad()
method and use it during GridTask.map(List, Object) or during collision
resolution.
Node metrics are updated with some delay which is directly related to heartbeat
frequency. For example, when used with default
GridMulticastDiscoverySpi the update will happen every 2 seconds.
Map<String,Object> attributes()
GridConfiguration.getUserAttributes() method.
The system adds the following attributes automatically:
{@link System#getProperties()} - All system properties.{@link System#getenv(String)} - All environment properties.GridNodeAttributesNote that attributes cannot be changed at runtime.
Collection<String> internalAddresses()
In many managed environments like Amazon EC2 a virtual instance and therefore a GridGain node can have multiple internal and external IP addresses. Internal addresses are used to address the node from within this environment, while external addresses used to address this node from the outside of this environment.
null but can be empty.Collection<String> externalAddresses()
In many managed environments like Amazon EC2 a virtual instance and therefore a GridGain node can have multiple internal and external IP addresses. Internal addresses are used to address the node from within this environment, while external addresses used to address this node from the outside of this environment.
null but can be empty.long order()
NOTE: in cases when discovery SPI doesn't support ordering GridGain cannot guarantee that orders on all nodes will be unique or chronologically correct. If such guarantee is required - make sure use discovery SPI that provides ordering.
|
GridGain 4.3.1e
Enterprise "Big Data" Edition |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
|
GridGain - In-Memory Big Data
|
|
|