Class ThrottledExecutor

  • All Implemented Interfaces:
    Executor

    public class ThrottledExecutor
    extends Object
    implements Executor
    The ThrottledExecutor enables us to throttle the input of the executor. This can be useful when we don't wish to submit all the tasks at once in order to preserve memory.
    Author:
    Vasilis Vryniotis
    • Constructor Detail

      • ThrottledExecutor

        public ThrottledExecutor​(Executor executor,
                                 int maxConcurrentTasks)
        This Executor will block the main thread (when execute() is called) if the number of submitted and unfinished tasks reaches the provided limit. This enabled us to pace the input and reduce memory consumption.
        Parameters:
        executor -
        maxConcurrentTasks -