Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractQueuingExecutor

        public AbstractQueuingExecutor()
    • 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 interface Executor
        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.
        Specified by:
        submit in interface Executor
      • beforeUnregister

        public void beforeUnregister()
        Specified by:
        beforeUnregister in interface tigase.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