Package tigase.pubsub.utils.executors
Class AbstractQueuingExecutor
- java.lang.Object
-
- tigase.pubsub.utils.executors.AbstractQueuingExecutor
-
- All Implemented Interfaces:
tigase.kernel.beans.UnregisterAware
,Executor
- Direct Known Subclasses:
RateLimitingExecutor
public class AbstractQueuingExecutor extends java.lang.Object implements Executor, tigase.kernel.beans.UnregisterAware
Abstract class providing implementation of executor supporting task queueing and prioritization.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface tigase.pubsub.utils.executors.Executor
Executor.Priority
-
-
Field Summary
Fields Modifier and Type Field Description protected ExecutionQueue
queue
-
Constructor Summary
Constructors Constructor Description AbstractQueuingExecutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeUnregister()
protected void
execute()
Method called by subclass to execute a single task from the queue or wait for any task to appear.boolean
isOverloaded()
Checks if executor is overloaded.void
submit(Executor.Priority priority, java.lang.Runnable runnable)
Submits a task with a priority for execution.
-
-
-
Field Detail
-
queue
protected final ExecutionQueue queue
-
-
Method Detail
-
isOverloaded
public boolean isOverloaded()
Description copied from interface:Executor
Checks if executor is overloaded. If returns true, then you should not try to submit any new tasks for a while.- Specified by:
isOverloaded
in interfaceExecutor
- Returns:
- true - executor is overloaded
-
submit
public void submit(Executor.Priority priority, java.lang.Runnable runnable)
Description copied from interface:Executor
Submits a task with a priority for execution.
-
beforeUnregister
public void beforeUnregister()
- Specified by:
beforeUnregister
in interfacetigase.kernel.beans.UnregisterAware
-
execute
protected void execute() throws java.lang.InterruptedException
Method called by subclass to execute a single task from the queue or wait for any task to appear.- Throws:
java.lang.InterruptedException
-
-