List and explain all the parameters for the following constructor of the ThreadPoolExecutor.
ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
corePoolSize: number of threads to keep in the pool unless allowCoreThreadTimeOut(boolean value) with a true value
maximumPoolSize: maximum number of threads allowed in the pool
keepAliveTime: when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
unit: time unit for the keepAliveTime argument.
workQueue: queue used for holding tasks before they are executed; this queue will hold only the Runnable objects submitted by the execute() method
threadFactory: is the factory to use when the executor creates a new thread
handler: is the handler to use when the execution is blocked because the thread bounds and queue capacities are reached.
Learn More :
Multithreading and Concurrent Processing
- What is the advantage of using concurrent collections from the java.util.concurrent package instead of a regular property?
- Where in the JCL can alternate forms of threading locks be found?
- How does a synchronized block improve performance compared to using the synchronized keyword?
- What is one positive and negative aspect of using the synchronized keyword to prevent concurrent access issues?
- How does the Exchanger class of the concurrent package support synchronization between threads?
- How does the Phaser class of the concurrent package support synchronization between threads?
- How does the CyclicBarrier class of the concurrent package support synchronization between threads?
- How does the CountDownLatch class of the concurrent package support synchronization between threads?
- How does the Semaphore class of the concurrent package support synchronization between threads?
- What is an Atomic variable (from the java.util.concurrent.atomic package) and how does it prevent concurrent access issues?
- What is one of the dangers of concurrent access and modification of a property?
- What is a deadlock, and what causes it?
- What is the difference between concurrent and parallel processing in computer science?
- What is the function of the Future submit(Callable task) method of the ExecutorService interface?
- What is the function of the Future<?> submit(Runnable task, T result) method of the ExecutorService interface?
- What is the function of the Future<?> submit(Runnable task) method of the ExecutorService interface?
- What is the purpose of the Future type objects that are returned from some of the ExecutorService methods?
- What is the function of the boolean isCancelled() method of the Future interface?
- What is the function of the boolean cancel(boolean mayInterruptIfRunning) method of the Future interface?
- What is the function of the boolean isDone() method of the Future interface?
- What is the function of the V get() and V get(long timeout, TimeUnit unit) methods of the Future interface?
- What cycle can be applied to best optimize the pool size based on the individual computer?
- What are the dangers of having a pool that is too big or too small?
- How do you ensure that isInterrupted() actually reflects the status of the thread?
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.