Java Thread (ii)

Source: Internet
Author: User

Start (); Starts the thread run (), the system calls sleep (int millsecond), sleeps for a period of time isalive (); Is active currentthread (); When the front-end interrupt (); Re-queue yield (); Pause the current thread, execute another thread

A thread pool is a collection of threads created when a multithreaded application is created, and then reused for new tasks instead of creating a new thread

Several states of a thread:

New state, ready state, running state, blocking state, death (termination) status

Thread Assignment Name:

threadtest T1 = new ThreadTest (); Thread  t01 = new Thread (T1, "bread");

.....
if (i==3) {
Thread.yield ();
Thread.wait ();
}
.....
Object.notify ();

http://blog.csdn.net/kaka534/article/details/51849285

callerrunspolicy: The thread invokes the execute itself that runs the task

AbortPolicy: handler rejection will throw runtime rejectedexecutionexception

Discardpolicy: The task that cannot be performed will be deleted

Discardoldestpolicy: If the execution program has not been closed, the task in the head of the work queue is deleted, and then the execution of the program is retried (repeat this process if it fails again)

Java Thread (ii)

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.