public class GridTcpDiscoveryNode extends GridMetadataAwareAdapter implements GridNode, Comparable<GridTcpDiscoveryNode>, Externalizable
GridTcpDiscoverySpi.
This class is not intended for public use and has been made public due to certain limitations of Java technology.
| Constructor and Description |
|---|
GridTcpDiscoveryNode()
Public default no-arg constructor for
Externalizable interface. |
GridTcpDiscoveryNode(UUID id,
Collection<String> addrs,
Collection<String> hostNames,
int discPort,
GridDiscoveryMetricsProvider metricsProvider,
GridProductVersion ver)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Collection<String> |
addresses()
Gets collection of addresses this node is known by.
|
<T> T |
attribute(String name)
Gets a node attribute.
|
Map<String,Object> |
attributes()
Gets all node attributes.
|
int |
compareTo(GridTcpDiscoveryNode node) |
Object |
consistentId()
Gets consistent globally unique node ID.
|
int |
discoveryPort() |
boolean |
equals(Object o) |
Map<String,Object> |
getAttributes()
Gets node attributes without filtering.
|
int |
hashCode() |
Collection<String> |
hostNames()
Gets collection of host names this node is known by.
|
UUID |
id()
Gets globally unique node ID.
|
long |
internalOrder() |
void |
internalOrder(long intOrder) |
boolean |
isDaemon()
Tests whether or not this node is a daemon.
|
boolean |
isLocal()
Tests whether or not this node is a local node.
|
long |
lastUpdateTime()
Gets node last update time.
|
void |
lastUpdateTime(long lastUpdateTime)
Sets node last update.
|
void |
local(boolean loc) |
void |
logger(GridLogger log)
Sets log.
|
GridNodeMetrics |
metrics()
Gets metrics snapshot for this node.
|
void |
metricsStore(GridTcpDiscoveryMetricsStore metricsStore)
Sets metrics store.
|
long |
order()
Node order within grid topology.
|
void |
order(long order) |
void |
readExternal(ObjectInput in) |
void |
setAttributes(Map<String,Object> attrs)
Sets node attributes.
|
void |
setMetrics(GridNodeMetrics metrics)
Sets node metrics.
|
Collection<InetSocketAddress> |
socketAddresses() |
String |
toString() |
GridProductVersion |
version()
Gets node version.
|
void |
version(GridProductVersion ver) |
boolean |
visible()
Gets visible flag.
|
void |
visible(boolean visible)
Sets visible flag.
|
void |
writeExternal(ObjectOutput out) |
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMetafinalize, getClass, notify, notifyAll, wait, wait, waitaddMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMetapublic GridTcpDiscoveryNode()
Externalizable interface.public GridTcpDiscoveryNode(UUID id, Collection<String> addrs, Collection<String> hostNames, int discPort, GridDiscoveryMetricsProvider metricsProvider, GridProductVersion ver)
id - Node Id.addrs - Addresses.hostNames - Host names.discPort - Port.metricsProvider - Metrics provider.ver - Version.public void metricsStore(GridTcpDiscoveryMetricsStore metricsStore)
metricsStore - Metrics store.public void logger(GridLogger log)
log - Grid logger.public UUID id()
public Object consistentId()
GridNode.id() method,
this method returns consistent node ID which survives node restarts.consistentId in interface GridNodepublic <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.
public 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.
attributes in interface GridNodepublic void setAttributes(Map<String,Object> attrs)
attrs - Node attributes.public Map<String,Object> getAttributes()
public GridNodeMetrics metrics()
GridNodeMetrics.getCurrentCpuLoad()
method and use it during GridComputeTask.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
GridTcpDiscoverySpi the update will happen every 2 seconds.
public void setMetrics(GridNodeMetrics metrics)
metrics - Node metrics.public long internalOrder()
public void internalOrder(long intOrder)
intOrder - Internal order of the node.public long order()
GridNodeNOTE: 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.
public void order(long order)
order - Order of the node.public GridProductVersion version()
public void version(GridProductVersion ver)
ver - Version.public Collection<String> addresses()
If GridConfiguration.getLocalHost() value isn't null node will try to use that
address for all communications and returned collection will contain only that address.
If it is null then local wildcard address will be used, and GridGain
will make the best effort to supply all addresses of that node in returned collection.
public boolean isLocal()
public void local(boolean loc)
loc - Grid local node flag.public boolean isDaemon()
Daemon nodes are the usual grid nodes that participate in topology but not
visible on the main APIs, i.e. they are not part of any projections. The only
way to see daemon nodes is to use GridProjection.forDaemons() method.
Daemon nodes are used primarily for management and monitoring functionality that is build on GridGain and needs to participate in the topology but should be excluded from "normal" topology so that it won't participate in task execution or in-memory database.
Application code should never use daemon nodes.
public Collection<String> hostNames()
If GridConfiguration.getLocalHost() value isn't null node will try to use
the host name of that resolved address for all communications and
returned collection will contain only that host name.
If that host name can not be resolved then ip address returned by method GridNode.addresses() is used.
If GridConfiguration.getLocalHost() value is null then local wildcard address will be used,
and this method returns host names of all addresses of that node.
public int discoveryPort()
public Collection<InetSocketAddress> socketAddresses()
public long lastUpdateTime()
public void lastUpdateTime(long lastUpdateTime)
lastUpdateTime - Time of last metrics update.public boolean visible()
true if node is in visible state.public void visible(boolean visible)
visible - true if node is in visible state.public int compareTo(@Nullable GridTcpDiscoveryNode node)
compareTo in interface Comparable<GridTcpDiscoveryNode>public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionCopyright © 2014. All rights reserved.