Package org.eclipse.net4j.util.concurrent

## Class TimerLifecycle

- java.lang.Object
- - java.util.Timer
  - - org.eclipse.net4j.util.concurrent.TimerLifecycle

- All Implemented Interfaces:
    `INotifier`, `IDeactivateable`, `ILifecycle`

      public class TimerLifecycle
      extends java.util.Timer
      implements ILifecycle

  Since:
    2.0
  Author:
    Eike Stepper

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `TimerLifecycle.DaemonFactory` |

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

      `ILifecycle.DeferrableActivation`

    - ### Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

      `INotifier.INotifier2`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `PRODUCT_GROUP` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TimerLifecycle()` |
    `TimerLifecycle​(boolean isDaemon)` |
    `TimerLifecycle​(java.lang.String name)` |
    `TimerLifecycle​(java.lang.String name, boolean isDaemon)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `activate()` |
    `void` | `addListener​(IListener listener)` | Adds a listener to this notifier.
    `void` | `cancel()` |
    `java.lang.Exception` | `deactivate()` |
    `LifecycleState` | `getLifecycleState()` |
    `IListener[]` | `getListeners()` | Returns the listeners that are registered with this notifier.
    `boolean` | `hasListeners()` | Returns `true` if one or more listeners are registered with this notifier, `false` otherwise.
    `boolean` | `isActive()` |
    `void` | `removeListener​(IListener listener)` | Removes a listener from this notifier.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.util.Timer

      `purge, schedule, schedule, schedule, schedule, scheduleAtFixedRate, scheduleAtFixedRate`

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

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

- - ### Field Detail

    - #### PRODUCT_GROUP

          public static final java.lang.String PRODUCT_GROUP

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimerLifecycle

          public TimerLifecycle()

    - #### TimerLifecycle

          public TimerLifecycle​(boolean isDaemon)

    - #### TimerLifecycle

          public TimerLifecycle​(java.lang.String name)

    - #### TimerLifecycle

          public TimerLifecycle​(java.lang.String name,
                                boolean isDaemon)

  - ### Method Detail

    - #### getLifecycleState

          public final LifecycleState getLifecycleState()

      Specified by:
        `getLifecycleState` in interface `ILifecycle`
      Since:
        3.0

    - #### isActive

          public final boolean isActive()

      Specified by:
        `isActive` in interface `ILifecycle`

    - #### addListener

          public void addListener​(IListener listener)

      Description copied from interface: `INotifier`
      Adds a listener to this notifier.

      Depending on the implementation duplicate listeners may lead to duplicate event delivery or not. Implementors are encouraged to prevent events from being delivered more than once to the same listener,

      Specified by:
        `addListener` in interface `INotifier`

    - #### removeListener

          public void removeListener​(IListener listener)

      Description copied from interface: `INotifier`
      Removes a listener from this notifier.
      Specified by:
        `removeListener` in interface `INotifier`

    - #### getListeners

          public IListener[] getListeners()

      Description copied from interface: `INotifier`
      Returns the listeners that are registered with this notifier.

      Depending on the implementation duplicate listeners may be contained in the returned array.

      Specified by:
        `getListeners` in interface `INotifier`

    - #### hasListeners

          public boolean hasListeners()

      Description copied from interface: `INotifier`
      Returns `true` if one or more listeners are registered with this notifier, `false` otherwise.
      Specified by:
        `hasListeners` in interface `INotifier`

    - #### activate

          public final void activate()
                              throws LifecycleException

      Specified by:
        `activate` in interface `ILifecycle`
      Throws:
        `LifecycleException`

    - #### deactivate

          public final java.lang.Exception deactivate()

      Specified by:
        `deactivate` in interface `IDeactivateable`
      Specified by:
        `deactivate` in interface `ILifecycle`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### cancel

          public void cancel()

      Overrides:
        `cancel` in class `java.util.Timer`