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 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
execute()
Method called by subclass to execute a single task from the queue or wait for any task to appear.boolean
Checks if executor is overloaded.void
submit
(Executor.Priority priority, Runnable runnable) Submits a task with a priority for execution.
-
Field Details
-
queue
-
-
Constructor Details
-
AbstractQueuingExecutor
public AbstractQueuingExecutor()
-
-
Method Details
-
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
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
Method called by subclass to execute a single task from the queue or wait for any task to appear.- Throws:
InterruptedException
-