org.apache.felix.eventadmin.impl
Class Activator

java.lang.Object
  extended by org.apache.felix.eventadmin.impl.Activator
All Implemented Interfaces:
BundleActivator

public class Activator
extends Object
implements BundleActivator

The activator of the EventAdmin bundle. This class registers an implementation of the OSGi R4 EventAdmin service (see the Compendium 113) with the framework. It features timeout-based blacklisting of event-handlers for both, asynchronous and synchronous event-dispatching (as a spec conform optional extension). The service knows about the following properties which are read at bundle startup:

org.apache.felix.eventadmin.CacheSize - The size of various internal caches.

The default value is 30. Increase in case of a large number (more then 100) of EventHandler services. A value less then 10 triggers the default value.

org.apache.felix.eventadmin.ThreadPoolSize - The size of the thread pool.

The default value is 10. Increase in case of a large amount of synchronous events where the EventHandler services in turn send new synchronous events in the event dispatching thread or a lot of timeouts are to be expected. A value of less then 2 triggers the default value. A value of 2 effectively disables thread pooling.

org.apache.felix.eventadmin.Timeout - The black-listing timeout in milliseconds

The default value is 5000. Increase or decrease at own discretion. A value of less then 100 turns timeouts off. Any other value is the time in milliseconds granted to each EventHandler before it gets blacklisted.

org.apache.felix.eventadmin.RequireTopic - Are EventHandler required to be registered with a topic?

The default is true. The specification says that EventHandler must register with a list of topics they are interested in. Setting this value to false will enable that handlers without a topic are receiving all events (i.e., they are treated the same as with a topic=*).

Author:
Felix Project Team

Constructor Summary
Activator()
           
 
Method Summary
protected  EventAdminImpl createEventAdmin(BundleContext context, HandlerTasks handlerTasks, DeliverTasks asyncExecuters, DeliverTasks syncExecuters)
          Create a event admin implementation.
 void start(BundleContext context)
          Called upon starting of the bundle.
 void stop(BundleContext context)
          Called upon stopping the bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Activator

public Activator()
Method Detail

start

public void start(BundleContext context)
Called upon starting of the bundle. Constructs and registers the EventAdmin service with the framework. Note that the properties of the service are requested from the context in this method hence, the bundle has to be restarted in order to take changed properties into account.

Specified by:
start in interface BundleActivator
Parameters:
context - The bundle context passed by the framework
See Also:
BundleActivator.start(org.osgi.framework.BundleContext)

stop

public void stop(BundleContext context)
Called upon stopping the bundle. This will block until all pending events are delivered. An IllegalStateException will be thrown on new events starting with the begin of this method. However, it might take some time until we settle down which is somewhat cumbersome given that the spec asks for return in a timely manner.

Specified by:
stop in interface BundleActivator
Parameters:
context - The bundle context passed by the framework
See Also:
BundleActivator.stop(org.osgi.framework.BundleContext)

createEventAdmin

protected EventAdminImpl createEventAdmin(BundleContext context,
                                          HandlerTasks handlerTasks,
                                          DeliverTasks asyncExecuters,
                                          DeliverTasks syncExecuters)
Create a event admin implementation.

Parameters:
context - The bundle context
handlerTasks -
asyncExecuters -
syncExecuters -
Returns:


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.