Discussion on concurrent processing of java.util.concurrent package
Source: Internet
Author: User
As we all know, before JDK1.5, Java in the business concurrency, often need to have a programmer to complete the code implementation, and when the high quality Java multithreaded concurrent programming, to prevent the emergence of such phenomena, such as the use of Java before the Wait (), notify () and synchronized, and so on, often need to consider performance, deadlock, fairness, resource management and how to avoid the harm caused by thread security and many other factors, tend to adopt some more complex security policies, Increases the programmer's burden of development. Luckily, after JDK1.5, Sun god finally launched the Java.util.concurrent Toolkit for our poor little programmers to simplify concurrency. Developers use this to effectively reduce competitive conditions (race conditions) and deadlock threads. The concurrent package solves these problems well and provides us with a more practical model of concurrent programs.
The main interfaces and classes under Java.util.concurrent:
Executor: The performer of a specific runnable task.
Executorservice: A thread pool manager, its implementation classes have a variety of, such as the common thread pool, timed dispatch thread pool Scheduledexecutorservice, etc., we can put a
Runnable,callable commits to the pool for scheduling.
Future: is an interface that interacts with runnable,callable, such as the result of a thread being returned after execution, and the cancel termination thread is also provided.
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.