org.apache.ignite.spi.discovery.tcp.messages

## Class TcpDiscoveryHeartbeatMessage

- java.lang.Object
- - org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage
  - - org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage

All Implemented Interfaces:
  Serializable

    @TcpDiscoveryRedirectToClient
    public class TcpDiscoveryHeartbeatMessage
    extends TcpDiscoveryAbstractMessage

Heartbeat message.

It is sent by coordinator node across the ring once a configured period. Message makes two passes:

1. During first pass, all nodes add their metrics to the message and update local metrics with metrics currently present in the message.
2. During second pass, all nodes update all metrics present in the message and remove their own metrics from the message.

When message reaches coordinator second time it is discarded (it finishes the second pass).

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `TcpDiscoveryHeartbeatMessage.MetricsSet`

### Field Summary

### Fields inherited from class org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage

`CLIENT_ACK_FLAG_POS, CLIENT_FLAG_POS, CLIENT_RECON_SUCCESS_FLAG_POS, FORCE_FAIL_FLAG_POS, RESPONDED_FLAG_POS`

### Constructor Summary

Constructors
Constructor and Description
`TcpDiscoveryHeartbeatMessage(UUID creatorNodeId)` Constructor.

### Method Summary

Methods
`void` `addClientNodeId(UUID clientNodeId)` Adds client node ID.
`Map<UUID,Map<Integer,CacheMetrics>>` `cacheMetrics()` Gets cache metrics map.
`Collection<UUID>` `clientNodeIds()` Gets client node IDs for particular node.
`boolean` `hasCacheMetrics()`
`boolean` `hasCacheMetrics(UUID nodeId)`
`boolean` `hasMetrics()`
`boolean` `hasMetrics(UUID nodeId)`
`boolean` `highPriority()`
`Map<UUID,TcpDiscoveryHeartbeatMessage.MetricsSet>` `metrics()` Gets metrics map.
`void` `removeCacheMetrics(UUID nodeId)` Removes cache metrics for particular node from the message.
`void` `removeMetrics(UUID nodeId)` Removes metrics for particular node from the message.
`void` `setCacheMetrics(UUID nodeId, Map<Integer,CacheMetrics> metrics)` Sets cache metrics for particular node.
`void` `setClientMetrics(UUID nodeId, UUID clientNodeId, ClusterMetrics metrics)` Sets metrics for a client node.
`void` `setMetrics(UUID nodeId, ClusterMetrics metrics)` Sets metrics for particular node.
`String` `toString()`
`boolean` `traceLogLevel()`

### Methods inherited from class org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage

`addFailedNode, client, client, creatorNodeId, equals, failedNodes, failedNodes, force, force, getFlag, hashCode, id, pendingIndex, pendingIndex, senderNodeId, senderNodeId, setFlag, topologyVersion, topologyVersion, verified, verifierNodeId, verify`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### TcpDiscoveryHeartbeatMessage

    public TcpDiscoveryHeartbeatMessage(UUID creatorNodeId)

Constructor.

Parameters:
  `creatorNodeId` - Creator node.

### Method Detail

#### setMetrics

    public void setMetrics(UUID nodeId,
                  ClusterMetrics metrics)

Sets metrics for particular node.

Parameters:
  `nodeId` - Node ID.
  `metrics` - Node metrics.

#### setCacheMetrics

    public void setCacheMetrics(UUID nodeId,
                       Map<Integer,CacheMetrics> metrics)

Sets cache metrics for particular node.

Parameters:
  `nodeId` - Node ID.
  `metrics` - Node cache metrics.

#### setClientMetrics

    public void setClientMetrics(UUID nodeId,
                        UUID clientNodeId,
                        ClusterMetrics metrics)

Sets metrics for a client node.

Parameters:
  `nodeId` - Server node ID.
  `clientNodeId` - Client node ID.
  `metrics` - Node metrics.

#### removeMetrics

    public void removeMetrics(UUID nodeId)

Removes metrics for particular node from the message.

Parameters:
  `nodeId` - Node ID.

#### removeCacheMetrics

    public void removeCacheMetrics(UUID nodeId)

Removes cache metrics for particular node from the message.

Parameters:
  `nodeId` - Node ID.

#### metrics

    public Map<UUID,TcpDiscoveryHeartbeatMessage.MetricsSet> metrics()

Gets metrics map.

Returns:
  Metrics map.

#### cacheMetrics

    public Map<UUID,Map<Integer,CacheMetrics>> cacheMetrics()

Gets cache metrics map.

Returns:
  Cache metrics map.

#### hasMetrics

    public boolean hasMetrics()

Returns:
  `True` if this message contains metrics.

#### hasCacheMetrics

    public boolean hasCacheMetrics()

Returns:
  `True` this message contains cache metrics.

#### hasMetrics

    public boolean hasMetrics(UUID nodeId)

Returns:
  `True` if this message contains metrics.

#### hasCacheMetrics

    public boolean hasCacheMetrics(UUID nodeId)

Parameters:
  `nodeId` - Node ID.
Returns:
  `True` if this message contains cache metrics for particular node.

#### clientNodeIds

    public Collection<UUID> clientNodeIds()

Gets client node IDs for particular node.

Returns:
  Client node IDs.

#### addClientNodeId

    public void addClientNodeId(UUID clientNodeId)

Adds client node ID.

Parameters:
  `clientNodeId` - Client node ID.

#### traceLogLevel

    public boolean traceLogLevel()

Overrides:
  `traceLogLevel` in class `TcpDiscoveryAbstractMessage`
Returns:
  `True` if need use trace logging for this message (to reduce amount of logging with debug level).

#### highPriority

    public boolean highPriority()

Overrides:
  `highPriority` in class `TcpDiscoveryAbstractMessage`
Returns:
  `true` if message must be added to head of queue.

#### toString

    public String toString()

Overrides:
  `toString` in class `TcpDiscoveryAbstractMessage`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.9.0
Release Date | : March 2 2017