OpenNMS API 1.2.9

## org.opennms.netmgt.discovery
Class SuspectEventGenerator

    java.lang.Object
      org.opennms.netmgt.discovery.SuspectEventGenerator

All Implemented Interfaces:
  Fiber, java.lang.Runnable

final class SuspectEventGenerator
extends java.lang.Object
implements java.lang.Runnable, Fiber

This class represents a suspect event generator that takes instances of ping replies and converts them to events. The events are then sent to the event daemon.

Author:
  Brian Weaver , OpenNMS

Field Summary
`(package private) static java.lang.String` `EVENT_SOURCE_VALUE` The value used as the source of the event.
`private java.lang.String` `m_name` The name of the fiber.
`private FifoQueue` `m_replies` The queue where ping replies are recovered.
`private int` `m_status` The status of the fiber.
`private long` `m_ttl` The time to live to set on events sent out
`private java.lang.Thread` `m_worker` The worker thread that reads replies and sends events.

Fields inherited from interface org.opennms.core.fiber.Fiber
`RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED`

Constructor Summary
`(package private)` `SuspectEventGenerator(FifoQueue replyQ, long ttl)` Construts a new instance of the class that is used to send new suspect events.

Method Summary
`java.lang.String` `getName()` Returns the name of this fiber.
`int` `getStatus()` Returns the current status of the fiber.
`void` `run()` This method is used to do the main work for the fiber.
`void` `start()` Starts the fiber.
`void` `stop()` Stops the fiber if it is running.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EVENT_SOURCE_VALUE

    static final java.lang.String EVENT_SOURCE_VALUE

  The value used as the source of the event.

  See Also:
    Constant Field Values

### m_replies

    private FifoQueue m_replies

  The queue where ping replies are recovered.

### m_ttl

    private long m_ttl

  The time to live to set on events sent out

### m_status

    private int m_status

  The status of the fiber.

### m_name

    private java.lang.String m_name

  The name of the fiber.

### m_worker

    private java.lang.Thread m_worker

  The worker thread that reads replies and sends events.

Constructor Detail

### SuspectEventGenerator

    SuspectEventGenerator(FifoQueue replyQ,
                          long ttl)

  Construts a new instance of the class that is used to send new suspect events. The reply queue passed during construction is used to extract instances of `ping replies`found by the discovery process. The replies are turned into suspect node events and sent to eventd

Method Detail

### start

    public void start()

  Starts the fiber. The fiber is transitioned from `START_PENDING` to `STARTING` and once the fiber startup is complete the status is changed to `RUNNING`.

  If the fiber has already been started then an exception is generated.

  Specified by:
    `start` in interface `Fiber`
  Throws:
    `java.lang.IllegalStateException` - Thrown if the fiber has already been started.

### stop

    public void stop()

  Stops the fiber if it is running. If the fiber has never run then an illegal state exception is generated. This method sends the shutdown signal to the thread, but does not wait on the thread to complete.

  Specified by:
    `stop` in interface `Fiber`
  Throws:
    `java.lang.IllegalStateException` - Thrown if the fiber was never started.

### getStatus

    public int getStatus()

  Returns the current status of the fiber.

  Specified by:
    `getStatus` in interface `Fiber`
  Returns:
    The fiber's status.

### getName

    public java.lang.String getName()

  Returns the name of this fiber.

  Specified by:
    `getName` in interface `Fiber`
  Returns:
    The name of the fiber.

### run

    public void run()

  This method is used to do the main work for the fiber. This method is invoked once and will not return until the fiber is stopped, or a non-recovereable error occurs.

  After starting the status is changed to `RUNNING` and a loop starts. The loop extracts the instances of `Reply`objects and then generates XML based event messages that are sent to eventd

  Specified by:
    `run` in interface `java.lang.Runnable`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.