In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces you what is the principle of Executor, the content is very detailed, interested friends can refer to, hope to be helpful to you.
1. Introduction of Executor thread pool system. 1. Introduction of Executor framework
Executor: the uppermost parent interface of the java thread pool framework. In Executor, there is only the executor () method, which means that the thread pool of type Runnable is committed and executed.
ExecutorService: a subinterface of Executor, where the submit () method receives either Runnable or Callable parameters, and closes the thread pool using the shutdown () method after use, and no longer receives new tasks.
AbstractExecutorService: the default implementation class for ExecutorService.
ScheduledExecutorService: a subinterface of ExecutorService, which can be used for scheduled task scheduling.
ScheduledThreadPoolExecutor: provides another thread pool, thread pool for deferred and periodic execution.
ThreadPoolExecutor: the core class of AbstractExecutorService thread pool, which inherits from Java. The main function of Java thread pool is to create thread pool, assign thread resources to tasks, and execute tasks.
2. ThreadPoolExecutor source code parsing
ThreadPoolExecutor has several overloaded constructors, and we analyze the role of each parameter based on the most complete constructor.
Public ThreadPoolExecutor (int corePoolSize, / / number of core thread pools int maximumPoolSize, / / maximum number of thread pools long keepAliveTime, / / the number of threads is greater than the number of core thread pools The maximum survival time of idle threads TimeUnit unit, / / the time unit of the parameter BlockingQueue workQueue, / / thread waiting queue ThreadFactory threadFactory / / set the factory RejectedExecutionHandler handler for creating threads) {/ / set the deny policy if (corePoolSize < 0 | | maximumPoolSize)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.