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 aHandlerTasksin order to determine applicableEventHandlerfor a specific event and subsequently dispatches the event to the handlers viaDeliverTasks. To do this, it uses two differentDeliverTasksone for asynchronous and one for synchronous event delivery depending on whether itspost()or itssend()method is called. Note that the actual work is done in the implementations of theDeliverTasks. Additionally, a stop method is provided that prevents subsequent events to be delivered.- Author:
- Felix Project Team
-
-
Constructor Summary
Constructors Constructor Description EventAdminImpl(org.osgi.framework.BundleContext bundleContext, org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool syncPool, org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool asyncPool, int timeout, String[] ignoreTimeout, boolean requireTopic, String[] ignoreTopics, boolean addTimestamp, boolean addSubject)The constructor of theEventAdminimplementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpostEvent(org.osgi.service.event.Event event)Post an asynchronous event.voidsendEvent(org.osgi.service.event.Event event)Send a synchronous event.voidstop()This method can be used to stop the delivery of events.voidupdate(int timeout, String[] ignoreTimeout, boolean requireTopic, String[] ignoreTopics, boolean addTimestamp, boolean addSubject)Update the event admin with new configuration.
-
-
-
Constructor Detail
-
EventAdminImpl
public EventAdminImpl(org.osgi.framework.BundleContext bundleContext, org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool syncPool, org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool asyncPool, int timeout, String[] ignoreTimeout, boolean requireTopic, String[] ignoreTopics, boolean addTimestamp, boolean addSubject)The constructor of theEventAdminimplementation.- Parameters:
bundleContext- The bundle context to use.syncPool- The synchronous thread pool.asyncPool- The asynchronous thread pool.timeout- The thread execution timeout.ignoreTimeout- The thread ignore timeout.requireTopic- True to define the topic as required, false else.ignoreTopics- The array of topics to ignore.addTimestamp- True to add timestamp to the event, false else.addSubject- True to add subject to the event, false else.
-
-
Method Detail
-
postEvent
public void postEvent(org.osgi.service.event.Event event)
Post an asynchronous event.- Specified by:
postEventin interfaceorg.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:
sendEventin interfaceorg.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, boolean addTimestamp, boolean addSubject)Update the event admin with new configuration.- Parameters:
timeout- The event timeout.ignoreTimeout- The event ignore timeout.requireTopic- True if the event require a topic, false else.ignoreTopics- The array of topic to ignore.addTimestamp- True to add timestamp to the event, false else.addSubject- True to add subject to the event, false else.
-
-