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 ExecutionQueuequeue
-
Constructor Summary
Constructors Constructor Description AbstractQueuingExecutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeUnregister()protected voidexecute()Method called by subclass to execute a single task from the queue or wait for any task to appear.booleanisOverloaded()Checks if executor is overloaded.voidsubmit(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:ExecutorChecks if executor is overloaded. If returns true, then you should not try to submit any new tasks for a while.- Specified by:
isOverloadedin interfaceExecutor- Returns:
- true - executor is overloaded
-
submit
public void submit(Executor.Priority priority, java.lang.Runnable runnable)
Description copied from interface:ExecutorSubmits a task with a priority for execution.
-
beforeUnregister
public void beforeUnregister()
- Specified by:
beforeUnregisterin interfacetigase.kernel.beans.UnregisterAware
-
execute
protected void execute() throws java.lang.InterruptedExceptionMethod called by subclass to execute a single task from the queue or wait for any task to appear.- Throws:
java.lang.InterruptedException
-
-