org.apache.felix.eventadmin.impl.dispatch
Class TaskHandler

java.lang.Object
  extended by org.apache.felix.eventadmin.impl.dispatch.TaskHandler
All Implemented Interfaces:
TaskProducer, TaskQueue

public class TaskHandler
extends java.lang.Object
implements TaskQueue, TaskProducer

This class implements the TaskQueue and the TaskProducer interface. It makes the tasks added via the queue interface available via the producer interface until the queue is closed and the producer returns null.

Author:
Felix Project Team
See Also:
TaskQueue, TaskProducer

Constructor Summary
TaskHandler()
           
 
Method Summary
 void append(HandlerTask[] tasks)
          Append the tasks to this queue in one atomic operation while preserving their order.
 void close(HandlerTask shutdownTask)
          Close the queue.
 HandlerTask next()
          Block until a new task is ready and is returned or no more tasks will be returned.
 void push(HandlerTask[] tasks)
          Push the tasks to this queue in one atomic operation while preserving their order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskHandler

public TaskHandler()
Method Detail

append

public void append(HandlerTask[] tasks)
Append the tasks to this queue in one atomic operation while preserving their order.

Specified by:
append in interface TaskQueue
Parameters:
tasks - The tasks to append to this queue
Throws:
java.lang.IllegalStateException - in case that this queue is already closed
See Also:
TaskQueue.append(HandlerTask[])

push

public void push(HandlerTask[] tasks)
Push the tasks to this queue in one atomic operation while preserving their order.

Specified by:
push in interface TaskQueue
Parameters:
tasks - The tasks to push to the front of this queue.
Throws:
java.lang.IllegalStateException - in case that this queue is already closed
See Also:
TaskQueue.push(HandlerTask[])

close

public void close(HandlerTask shutdownTask)
Close the queue. The given shutdown task will be executed once the queue is empty.

Specified by:
close in interface TaskQueue
Parameters:
shutdownTask - The task to execute once the queue is empty
See Also:
TaskQueue.close(HandlerTask)

next

public HandlerTask next()
Block until a new task is ready and is returned or no more tasks will be returned.

Specified by:
next in interface TaskProducer
Returns:
The next task or null if no more tasks will be produced
See Also:
TaskProducer.next()