Package org.apache.felix.eventadmin.impl.tasks

## Class SyncDeliverTasks

- java.lang.Object
- - org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks

    public class SyncDeliverTasks
    extends Object

This class does the actual work of the synchronous event delivery. This is the heart of the event delivery. If an event is delivered without timeout handling, the event is directly delivered using the calling thread. If timeout handling is enabled, a new thread is taken from the thread pool and this thread is used to deliver the event. The calling thread is blocked until either the deliver is finished or the timeout occurs.

Note that in case of a timeout while a task is disabled the thread is released and we spin-off a new thread that resumes the disabled task hence, this is the only place were we break the semantics of the synchronous delivery. While the only one to notice this is the timed-out handler - it is the fault of this handler too (i.e., it blocked the dispatch for to long) but since it will not receive events anymore it will not notice this semantic difference except that it might not see events it already sent before. If during an event delivery a new event should be delivered from within the event handler, the timeout handler is stopped for the delivery time of the inner event!

Author:
  Felix Project Team

### Constructor Summary

Constructors
`SyncDeliverTasks​(DefaultThreadPool pool, long timeout)` Construct a new sync deliver tasks.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `execute​(Collection<EventHandlerProxy> tasks, org.osgi.service.event.Event event, boolean filterAsyncUnordered)` This blocks an unrelated thread used to send a synchronous event until the event is send (or a timeout occurs).
`void` `update​(long timeout)` Update the timeout configuration

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

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

### Constructor Detail

#### SyncDeliverTasks

    public SyncDeliverTasks​(DefaultThreadPool pool,
                            long timeout)

Construct a new sync deliver tasks.

Parameters:
  `pool` - The thread pool used to spin-off new threads.
  `timeout` - The timeout configuration

### Method Detail

#### update

    public void update​(long timeout)

Update the timeout configuration

Parameters:
  `timeout` - The timeout configuration

#### execute

    public void execute​(Collection<EventHandlerProxy> tasks,
                        org.osgi.service.event.Event event,
                        boolean filterAsyncUnordered)

This blocks an unrelated thread used to send a synchronous event until the event is send (or a timeout occurs).

Parameters:
  `tasks` - The event handler dispatch tasks to execute
  `event` - The event
  `filterAsyncUnordered` - async handling