The Interview thread pool

Source: Internet
Author: User

1. Overview

The Java thread pool works like a database connection pool, because each time a thread is re-created is a resource-intensive operation, so we can create a thread pool so that when something needs to be done with the thread, we can go directly to the thread pool and find the idle threads. This allows you to use it directly, instead of waiting for it to be used, and then you can put the thread back into the thread pool for other requests and use it to improve the performance of your application.

2. Core processes

2.1. Build a Threadpoolexecutor and specify the number of threads to be created by default

2.2. Use Threadpool.execute () to add a thread to execute the Java class that implements the Runable interface

2.3. Write the specific business code in the Run method of the Java class that implements the Runable interface

The Interview thread pool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.