Package org.apache.felix.eventadmin.impl.handler

## Class EventAdminImpl

- java.lang.Object
- - org.apache.felix.eventadmin.impl.handler.EventAdminImpl

All Implemented Interfaces:
  `org.osgi.service.event.EventAdmin`

    public class EventAdminImpl
    extends Object
    implements org.osgi.service.event.EventAdmin

This is the actual implementation of the OSGi R4 Event Admin Service (see the Compendium 113 for details). The implementation uses a `HandlerTasks` in order to determine applicable `EventHandler` for a specific event and subsequently dispatches the event to the handlers via `DeliverTasks`. To do this, it uses two different `DeliverTasks` one for asynchronous and one for synchronous event delivery depending on whether its `post()` or its `send()` method is called. Note that the actual work is done in the implementations of the `DeliverTasks`. Additionally, a stop method is provided that prevents subsequent events to be delivered.

Author:
  Felix Project Team

### Nested Class Summary

Nested Classes
`static interface` `EventAdminImpl.EventHandlerMBean`

### Constructor Summary

Constructors
`EventAdminImpl​(org.osgi.framework.BundleContext bundleContext, DefaultThreadPool syncPool, DefaultThreadPool asyncPool, int timeout, String[] ignoreTimeout, boolean requireTopic, String[] ignoreTopics)` The constructor of the `EventAdmin` implementation.

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `getHandlerInfoMBean()`
`void` `postEvent​(org.osgi.service.event.Event event)` Post an asynchronous event.
`void` `sendEvent​(org.osgi.service.event.Event event)` Send a synchronous event.
`void` `stop()` This method can be used to stop the delivery of events.
`void` `update​(int timeout, String[] ignoreTimeout, boolean requireTopic, String[] ignoreTopics)` Update the event admin with new configuration.

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

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

### Constructor Detail

#### EventAdminImpl

    public EventAdminImpl​(org.osgi.framework.BundleContext bundleContext,
                          DefaultThreadPool syncPool,
                          DefaultThreadPool asyncPool,
                          int timeout,
                          String[] ignoreTimeout,
                          boolean requireTopic,
                          String[] ignoreTopics)

The constructor of the `EventAdmin` implementation.

Parameters:
  `bundleContext` - The event admin bundle context
  `syncPool` - The synchronous thread pool
  `asyncPool` - The asynchronous thread pool
  `timeout` - The timeout
  `ignoreTimeout` - The configuration for ignoring timeouts
  `requireTopic` - Are topics required?
  `ignoreTopics` - The configuration to ignore topics

### Method Detail

#### postEvent

    public void postEvent​(org.osgi.service.event.Event event)

Post an asynchronous event.

Specified by:
  `postEvent` in interface `org.osgi.service.event.EventAdmin`
Parameters:
  `event` - The event to be posted by this service
Throws:
  `IllegalStateException` - - In case we are stopped
See Also:
  `EventAdmin.postEvent(org.osgi.service.event.Event)`

#### sendEvent

    public void sendEvent​(org.osgi.service.event.Event event)

Send a synchronous event.

Specified by:
  `sendEvent` in interface `org.osgi.service.event.EventAdmin`
Parameters:
  `event` - The event to be send by this service
Throws:
  `IllegalStateException` - - In case we are stopped
See Also:
  `EventAdmin.sendEvent(org.osgi.service.event.Event)`

#### stop

    public void stop()

This method can be used to stop the delivery of events.

#### update

    public void update​(int timeout,
                       String[] ignoreTimeout,
                       boolean requireTopic,
                       String[] ignoreTopics)

Update the event admin with new configuration.

Parameters:
  `timeout` - The timeout
  `ignoreTimeout` - The configuration for ignoring timeouts
  `requireTopic` - Are topics required?
  `ignoreTopics` - The configuration to ignore topics

#### getHandlerInfoMBean

    public Object getHandlerInfoMBean()