Spring threadpooltaskexecutor thread Pool

Source: Internet
Author: User

1: First Configure the thread pool (configured in the spring configuration file, I am configured in applicationcontext.xml)

<!--  Async thread pool  --><bean id= "Taskexecutor"       class= " Org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor ">    <!--  Number of core threads  -->    <property name= "Corepoolsize"  value= "5"  />     <!--  Maximum number of threads  -->    <property name= "Maxpoolsize"  value=  />    <!--  Queue Maximum length  >=mainexecutor.maxsize -- >    <property name= "queuecapacity"  value= " />  "   <!--  thread pool to maintain idle time allowed by thread  -->    <property name= " Keepaliveseconds " value="  />    <!--  thread pool processing policy for rejected tasks (wireless path available)  - ->    <property name= "Rejectedexecutionhandler" >         <bean class= "Java.util.concurrent.threadpoolexecutor$callerrunspolicy"  />    </property ></bean>

2: Inject Taskexecutor and use

Throws a thread directly into the thread pool, which controls when it is started and automatically calls its Run method

3: Thread Interface (responsequeuethread)

To this end, haha, very simple, welcome all kinds of spit groove, have better also please recommend, thank you! Thank you


Spring threadpooltaskexecutor 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.