org.apache.tamaya.events.spi

## Interface ConfigEventManagerSpi

- All Known Implementing Classes:
    DefaultConfigEventManagerSpi

      public interface ConfigEventManagerSpi

  SPI interface to implement the `ConfigEventManager` singleton. Implementations of this interface must be registered with the current `ServiceContext`, by default this equals to registering it with `ServiceLoader`. Add `Priority` annotations for overriding (higher values override lower values).

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> void` | `addListener(ConfigEventListener l)` Adds a listener for observing events.
    `<T extends ConfigEvent> void` | `addListener(ConfigEventListener l, Class<T> eventType)` Adds a listener for observing events of a given type.
    `void` | `enableChangeMonitor(boolean enable)` Start/stop the change monitoring service, which will observe/reevaluate the current configuration regularly and trigger ConfigurationChange events if something is changed.
    `void` | `fireEvent(ConfigEvent<?> event)` Publishes an event to all interested listeners, hereby executing all registered listeners sequentually and synchronously
    `void` | `fireEventAsynch(ConfigEvent<?> event)` Publishes an event to all interested listeners, hereby publishing the change events asynchrously and in parallel (multithreaded).
    `long` | `getChangeMonitoringPeriod()` Get the current check period to check for configuration changes.
    `Collection<? extends ConfigEventListener>` | `getListeners()` Access all globally registered listeners.
    `Collection<? extends ConfigEventListener>` | `getListeners(Class<? extends ConfigEvent> eventType)` Access all listeners listening for a certain event type, including any global listeners.
    `boolean` | `isChangeMonitorActive()` Check if the observer is running currently.
    `void` | `removeListener(ConfigEventListener l)` Removes a listener for observing events.
    `<T extends ConfigEvent> void` | `removeListener(ConfigEventListener l, Class<T> eventType)` Removes a listener for observing events of a certain type.
    `void` | `setChangeMonitoringPeriod(long millis)`

- - ### Method Detail

    - #### addListener

          <T> void addListener(ConfigEventListener l)

      Adds a listener for observing events. References of this component to the listeners must be managed as weak references.
      Type Parameters:
        `T` - the type of the events listened to.
      Parameters:
        `l` - the listener not null.

    - #### addListener

          <T extends ConfigEvent> void addListener(ConfigEventListener l,
                                                 Class<T> eventType)

      Adds a listener for observing events of a given type.
      Type Parameters:
        `T` - the type of the events listened to.
      Parameters:
        `l` - the listener not null.
        `eventType` - the type of concrete configuration event this listeners should be informed about. All other event types will never be delivered to this listener instance.

    - #### removeListener

          void removeListener(ConfigEventListener l)

      Removes a listener for observing events.
      Parameters:
        `l` - the listener not null.

    - #### removeListener

          <T extends ConfigEvent> void removeListener(ConfigEventListener l,
                                                    Class<T> eventType)

      Removes a listener for observing events of a certain type.
      Type Parameters:
        `T` - the type of the events listened to.
      Parameters:
        `l` - the listener not null.
        `eventType` - the type of concrete configuration event this listeners should be informed about. All other event types will never be delivered toe this listener instance.

    - #### getListeners

          Collection<? extends ConfigEventListener> getListeners()

      Access all globally registered listeners.
      Returns:
        the listeners found, never null.

    - #### getListeners

          Collection<? extends ConfigEventListener> getListeners(Class<? extends ConfigEvent> eventType)

      Access all listeners listening for a certain event type, including any global listeners.
      Parameters:
        `eventType` - the type of concrete configuration event this listeners should be informed about. All other event types will never be delivered toe this listener instance.
      Returns:
        the listeners found, never null.

    - #### fireEvent

          void fireEvent(ConfigEvent<?> event)

      Publishes an event to all interested listeners, hereby executing all registered listeners sequentually and synchronously.,
      Parameters:
        `event` - the event, not null.

    - #### fireEventAsynch

          void fireEventAsynch(ConfigEvent<?> event)

      Publishes an event to all interested listeners, hereby publishing the change events asynchrously and in parallel (multithreaded).
      Parameters:
        `event` - the event, not null.

    - #### getChangeMonitoringPeriod

          long getChangeMonitoringPeriod()

      Get the current check period to check for configuration changes.
      Returns:
        the check period in ms.

    - #### setChangeMonitoringPeriod

          void setChangeMonitoringPeriod(long millis)

    - #### isChangeMonitorActive

          boolean isChangeMonitorActive()

      Check if the observer is running currently.
      Returns:
        true, if the change monitoring service is currently running.

    - #### enableChangeMonitor

          void enableChangeMonitor(boolean enable)

      Start/stop the change monitoring service, which will observe/reevaluate the current configuration regularly and trigger ConfigurationChange events if something is changed. This is quite handy for publishing configuration changes to whatever systems are interested in. Hereby the origin of a configuration change can be on this machine, or also remotedly. For handling corresponding `ConfigEventListener` have to be registered, e.g. listening on `ConfigurationChange` events.
      Parameters:
        `enable` - whether to enable or disable the change monitoring.

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.