com.datumbox.framework.common.concurrency
Class ThrottledExecutor
- java.lang.Object
-
- com.datumbox.framework.common.concurrency.ThrottledExecutor
-
- All Implemented Interfaces:
- java.util.concurrent.Executor
public class ThrottledExecutor extends java.lang.Object implements java.util.concurrent.ExecutorThe 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.
-
-
Constructor Summary
Constructors Constructor and Description ThrottledExecutor(java.util.concurrent.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidexecute(java.lang.Runnable command)
-
-
-
Constructor Detail
-
ThrottledExecutor
public ThrottledExecutor(java.util.concurrent.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-
-
-
DataMelt 3.0 © DataMelt by jWork.ORG