Package org.apache.storm.kafka.spout.internal

# Class Timer

java.lang.Object
org.apache.storm.kafka.spout.internal.Timer

public class Timer extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Timer(long delay, long period, TimeUnit timeUnit)`
  Creates a class that mimics a single threaded timer that expires periodically.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `delay()`
  `TimeUnit`
  `getTimeUnit()`
  `boolean`
  `isExpiredResetOnTrue()`
  Checks if a call to this method occurs later than `period` since the timer was initiated or reset.
  `long`
  `period()`

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

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

- ## Constructor Details

  - ### Timer

    public Timer(long delay, long period, TimeUnit timeUnit)
    Creates a class that mimics a single threaded timer that expires periodically. If a call to `isExpiredResetOnTrue()` occurs later than `period` since the timer was initiated or reset, this method returns true. Each time the method returns true the counter is reset. The timer starts with the specified time delay.
    Parameters:
      `delay` - the initial delay before the timer starts
      `period` - the period between calls `isExpiredResetOnTrue()`
      `timeUnit` - the time unit of delay and period

- ## Method Details

  - ### period

    public long period()

  - ### delay

    public long delay()

  - ### getTimeUnit

    public TimeUnit getTimeUnit()

  - ### isExpiredResetOnTrue

    public boolean isExpiredResetOnTrue()
    Checks if a call to this method occurs later than `period` since the timer was initiated or reset. If that is the case the method returns true, otherwise it returns false. Each time this method returns true, the counter is reset (re-initiated) and a new cycle will start.
    Returns:
      true if the time elapsed since the last call returning true is greater than `period`. Returns false otherwise.