com.streambase.sb.monitor

## Class Snapshot

- java.lang.Object
- - com.streambase.sb.monitor.Snapshot

-     public class Snapshot
      extends Object

  Stores a snapshot of information from a StreamBase application. Snapshot objects are created by the StreamBaseMonitor class, and consumed by MonitorListeners. New snapshots are produced at regular intervals, depending on the period specified in the StreamBase Server's conf file.
  See Also:
    `StreamBaseMonitor`, `MonitorListener`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static interface` | `Snapshot.Source`
    `protected static class` | `Snapshot.Status`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<String>` | `containers`
    `protected int` | `cycle`
    `protected boolean` | `enableOperatorDetails`
    `protected boolean` | `gotBegin`
    `protected Set<String>` | `lastCycleContainers`
    `protected Map<String,ModuleInfo>` | `modInfos`
    `protected Map<String,String>` | `operatorTypes`
    `protected Map<String,OperatorInfo>` | `opInfos`
    `protected Timestamp` | `prev_timestamp`
    `protected Iterator<Tuple>` | `resultIterator`
    `protected StreamBaseMonitor` | `sbMonitor`
    `protected List<StatTuple>` | `statTuples`
    `protected Map<String,StreamInfo>` | `streamInfos`
    `protected SystemInfo` | `sysInfo`
    `protected Map<String,ThreadInfo>` | `thrInfos`
    `static long` | `TICKS_PER_MICROSECOND`
    `static long` | `TICKS_PER_MILLISECOND`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Snapshot(StreamBaseMonitor sbmon, boolean enableOperatorDetails)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<String>` | `containerNames()` Return a list of the names of the current containers
    `int` | `getCycle()` Returns the cycle number of this snapshot.
    `protected static String` | `getModName(String name)` Given a queue name, retrieve the module name.
    `ModuleInfo` | `getModuleInfo(String name)` Returns information about the specified module.
    `OperatorInfo` | `getOperatorInfo(String name)` Returns information about the specified operator.
    `protected String` | `getOperatorType(StreamBaseClient sbClient, String name)`
    `StreamInfo` | `getStreamInfo(String name)` Returns information about the specified stream.
    `SystemInfo` | `getSystemInfo()` The SystemInfo object for this snapshot.
    `ThreadInfo` | `getThreadInfo(String name)` Returns information about the specified thread.
    `Timestamp` | `getTimestamp()` Return the time when this snapshot was taken.
    `Iterator<ModuleInfo>` | `moduleInfos()` Returns an iterator over all the ModuleInfo objects.
    `Set<String>` | `moduleNames()` Returns the set of all thread names.
    `Iterator<OperatorInfo>` | `operatorInfos()` Returns an iterator over all the OperatorInfo objects.
    `Set<String>` | `operatorNames()` Returns the set of all operator names.
    `void` | `prettyPrint()` Shortcut for prettyPrint(true, true, true, false).
    `(package private) Snapshot.Status` | `readNextMonitorSnap(StreamBaseClient sbClient, Snapshot.Source source)` Read the next monitor snapshot, return Status if we are done or not
    `protected void` | `recycle()`
    `protected void` | `reset()` totally reset this snapshot
    `Iterator<StreamInfo>` | `streamInfos()` Returns an iterator over all the StreamInfo objects.
    `Set<String>` | `streamNames()` Returns the set of all stream names.
    `void` | `terminate()` Ask the StreamBaseMonitor to terminate at the end of the current snapshot.
    `Iterator<ThreadInfo>` | `threadInfos()` Returns an iterator over all the ThreadInfo objects.
    `Set<String>` | `threadNames()` Returns the set of all thread names.
    `String` | `toString()` Returns a string representation of the Snapshot object.

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

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

- - ### Field Detail

    - #### TICKS_PER_MILLISECOND

          public static final long TICKS_PER_MILLISECOND

      See Also:
        Constant Field Values

    - #### TICKS_PER_MICROSECOND

          public static final long TICKS_PER_MICROSECOND

      See Also:
        Constant Field Values

    - #### cycle

          protected int cycle

    - #### statTuples

          protected List<StatTuple> statTuples

    - #### containers

          protected Set<String> containers

    - #### operatorTypes

          protected Map<String,String> operatorTypes

    - #### lastCycleContainers

          protected Set<String> lastCycleContainers

    - #### opInfos

          protected Map<String,OperatorInfo> opInfos

    - #### thrInfos

          protected Map<String,ThreadInfo> thrInfos

    - #### modInfos

          protected Map<String,ModuleInfo> modInfos

    - #### streamInfos

          protected Map<String,StreamInfo> streamInfos

    - #### sysInfo

          protected SystemInfo sysInfo

    - #### sbMonitor

          protected final StreamBaseMonitor sbMonitor

    - #### enableOperatorDetails

          protected final boolean enableOperatorDetails

    - #### prev_timestamp

          protected Timestamp prev_timestamp

    - #### gotBegin

          protected boolean gotBegin

    - #### resultIterator

          protected Iterator<Tuple> resultIterator

  - ### Constructor Detail

    - #### Snapshot

          protected Snapshot(StreamBaseMonitor sbmon,
                             boolean enableOperatorDetails)

  - ### Method Detail

    - #### readNextMonitorSnap

          Snapshot.Status readNextMonitorSnap(StreamBaseClient sbClient,
                                              Snapshot.Source source)
                                       throws StreamBaseException

      Read the next monitor snapshot, return Status if we are done or not
      Parameters:
        `sbClient` -
        `source` -
      Returns:
        status if we are done or not
      Throws:
        `StreamBaseException`

    - #### terminate

          public void terminate()

      Ask the StreamBaseMonitor to terminate at the end of the current snapshot.
      See Also:
        `StreamBaseMonitor.terminate()`

    - #### getModName

          protected static final String getModName(String name)

      Given a queue name, retrieve the module name.
      Parameters:
        `name` - queue name
      Returns:
        module name

    - #### getOperatorType

          protected String getOperatorType(StreamBaseClient sbClient,
                                           String name)
                                    throws StreamBaseException

      Throws:
        `StreamBaseException`

    - #### containerNames

          public Set<String> containerNames()

      Return a list of the names of the current containers
      Returns:
        list of the names of the current containers

    - #### getSystemInfo

          public SystemInfo getSystemInfo()

      The SystemInfo object for this snapshot.
      Returns:
        the SystemInfo object

    - #### getOperatorInfo

          public OperatorInfo getOperatorInfo(String name)

      Returns information about the specified operator.
      Parameters:
        `name` - the operator name
      Returns:
        the requested OperatorInfo object

    - #### getThreadInfo

          public ThreadInfo getThreadInfo(String name)

      Returns information about the specified thread.
      Parameters:
        `name` - the thread name
      Returns:
        the requested ThreadInfo object

    - #### getModuleInfo

          public ModuleInfo getModuleInfo(String name)

      Returns information about the specified module.
      Parameters:
        `name` - the module name
      Returns:
        the requested ModuleInfo object

    - #### getStreamInfo

          public StreamInfo getStreamInfo(String name)

      Returns information about the specified stream.
      Parameters:
        `name` - the stream name
      Returns:
        the requested StreamInfo object

    - #### operatorInfos

          public Iterator<OperatorInfo> operatorInfos()

      Returns an iterator over all the OperatorInfo objects.
      Returns:
        an Iterator of OperatorInfos
      See Also:
        `Snapshot.getOperatorInfo(java.lang.String)`

    - #### operatorNames

          public Set<String> operatorNames()

      Returns the set of all operator names.
      Returns:
        Set of operator names
      See Also:
        `Snapshot.getOperatorInfo(java.lang.String)`

    - #### threadInfos

          public Iterator<ThreadInfo> threadInfos()

      Returns an iterator over all the ThreadInfo objects.
      Returns:
        an Iterator of ThreadInfos
      See Also:
        `Snapshot.getThreadInfo(java.lang.String)`

    - #### threadNames

          public Set<String> threadNames()

      Returns the set of all thread names.
      Returns:
        Set of thread names
      See Also:
        `Snapshot.getThreadInfo(java.lang.String)`

    - #### moduleInfos

          public Iterator<ModuleInfo> moduleInfos()

      Returns an iterator over all the ModuleInfo objects.
      Returns:
        an Iterator of ModuleInfo
      See Also:
        `Snapshot.getModuleInfo(java.lang.String)`

    - #### moduleNames

          public Set<String> moduleNames()

      Returns the set of all thread names.
      Returns:
        Set of thread names
      See Also:
        `Snapshot.getThreadInfo(java.lang.String)`

    - #### streamInfos

          public Iterator<StreamInfo> streamInfos()

      Returns an iterator over all the StreamInfo objects.
      Returns:
        an Iterator of StreamInfo
      See Also:
        `Snapshot.getStreamInfo(java.lang.String)`

    - #### streamNames

          public Set<String> streamNames()

      Returns the set of all stream names.
      Returns:
        Set of stream names
      See Also:
        `Snapshot.getStreamInfo(java.lang.String)`

    - #### getCycle

          public int getCycle()

      Returns the cycle number of this snapshot. All subsequent snapshots will have an increasing cycle number. This is a monotonically increasing integer generated by the StreamBase daemon.
      Returns:
        snapshot cycle number

    - #### getTimestamp

          public Timestamp getTimestamp()

      Return the time when this snapshot was taken. It is the timestamp of the first tuple of this snapshot.
      Returns:
        timestamp of whhen this snapshot was taken

    - #### reset

          protected void reset()

      totally reset this snapshot

    - #### recycle

          protected void recycle()

    - #### toString

          public String toString()

      Returns a string representation of the Snapshot object.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of the object.

    - #### prettyPrint

          public void prettyPrint()

      Shortcut for prettyPrint(true, true, true, false).
      See Also:
        `Snapshot.prettyPrint(boolean,boolean,boolean,boolean)`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.