Monitor
Date: 2016-02-29

de.zib.scalaris

## Class Monitor

- java.lang.Object
- - de.zib.scalaris.Monitor

-     public class Monitor
      extends Object

  Provides methods to monitor a specific Scalaris (Erlang) VM.
  Since:
    3.11
  Version:
    3.11
  Author:
    Nico Kruber, kruber@zib.de

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Monitor.GetNodeInfoResult` Plain old data object for results of `getNodeInfo()`.
    `static class` | `Monitor.GetNodePerformanceResult` Plain old data object for results of `getNodePerformance()`.
    `static class` | `Monitor.GetServiceInfoResult` Plain old data object for results of `getServiceInfo()`.
    `static class` | `Monitor.GetServicePerformanceResult` Plain old data object for results of `getServicePerformance()`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Monitor(String node)` Creates a connection to the erlang VM of the given Scalaris node.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeConnection()` Closes the transaction's connection to a scalaris node.
    `static Double` | `getCurrentPerfValue(Map<Long,Double> map)` Extracts the current performance value of a timestamp-to-double map like in the members of `Monitor.GetNodePerformanceResult` or `Monitor.GetServicePerformanceResult`.
    `Monitor.GetNodeInfoResult` | `getNodeInfo()` Gets some information about the VM and Scalaris.
    `Monitor.GetNodePerformanceResult` | `getNodePerformance()` Gets some information about the VM and Scalaris.
    `Monitor.GetServiceInfoResult` | `getServiceInfo()` Gets some information about the Scalaris ring.
    `Monitor.GetServicePerformanceResult` | `getServicePerformance()` Gets some information about the Scalaris ring.

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Monitor

          public Monitor(String node)
                  throws ConnectionException

      Creates a connection to the erlang VM of the given Scalaris node. Uses the connection policy of the global connection factory.
      Parameters:
        `node` - Scalaris node to connect with
      Throws:
        `ConnectionException` - if the connection fails or the connection policy is not cloneable

  - ### Method Detail

    - #### getNodeInfo

          public Monitor.GetNodeInfoResult getNodeInfo()
                                                throws ConnectionException,
                                                       UnknownException

      Gets some information about the VM and Scalaris.
      Returns:
        VM information
      Throws:
        `ConnectionException` - if the connection is not active or a communication error occurs or an exit signal was received or the remote node sends a message containing an invalid cookie
        `UnknownException` - if any other error occurs

    - #### getNodePerformance

          public Monitor.GetNodePerformanceResult getNodePerformance()
                                                              throws ConnectionException,
                                                                     UnknownException

      Gets some information about the VM and Scalaris.
      Returns:
        VM information
      Throws:
        `ConnectionException` - if the connection is not active or a communication error occurs or an exit signal was received or the remote node sends a message containing an invalid cookie
        `UnknownException` - if any other error occurs

    - #### getServiceInfo

          public Monitor.GetServiceInfoResult getServiceInfo()
                                                      throws ConnectionException,
                                                             UnknownException

      Gets some information about the Scalaris ring.
      Returns:
        Scalaris ring information
      Throws:
        `ConnectionException` - if the connection is not active or a communication error occurs or an exit signal was received or the remote node sends a message containing an invalid cookie
        `UnknownException` - if any other error occurs

    - #### getServicePerformance

          public Monitor.GetServicePerformanceResult getServicePerformance()
                                                                    throws ConnectionException,
                                                                           UnknownException

      Gets some information about the Scalaris ring.
      Returns:
        Scalaris ring information
      Throws:
        `ConnectionException` - if the connection is not active or a communication error occurs or an exit signal was received or the remote node sends a message containing an invalid cookie
        `UnknownException` - if any other error occurs

    - #### closeConnection

          public void closeConnection()

      Closes the transaction's connection to a scalaris node. Note: Subsequent calls to the other methods will throw `ConnectionException`s!

    - #### getCurrentPerfValue

          public static Double getCurrentPerfValue(Map<Long,Double> map)

      Extracts the current performance value of a timestamp-to-double map like in the members of `Monitor.GetNodePerformanceResult` or `Monitor.GetServicePerformanceResult`.
      Parameters:
        `map` - the map to extract from
      Returns:
        the latest reported performance or `null` if there is none