Thinking in Java (multithreading summary)

Source: Internet
Author: User

1 thread creation, the thread class and the Runnable interface.

Http://www.cnblogs.com/dolphin0520/p/3913517.html

2notify and Wait,condition

Http://www.cnblogs.com/dolphin0520/p/3920385.html

    • Condition is an interface, the basic method is the await () and the signal () method;
    • Condition relies on the lock interface, generating a condition base code that is Lock.newcondition ()
    • The await () and signal () methods that call condition must be within lock protection, meaning they must be between Lock.lock () and Lock.unlock.

--------------------------------------------------------------------------------------------------------

    • Await () in Conditon corresponds to the Wait () of object;
    • The signal () in condition corresponds to the Notify () of the object;
    • The Signalall () in condition corresponds to the Notifyall () of the object.

The basic method of 3Thread.

Http://www.cnblogs.com/dolphin0520/p/3920357.html

Start (), run (), sleep (), yield (), join (), interrupt (), stop (), Destroy ()

GetId (), Getname/setname,getpriority/setpriority,setdaemon, and Isdaemon (sets whether the thread becomes the daemon thread and determines whether the thread is a daemon thread)

4synchronized

Synchronized is a Java keyword and is a built-in property of Java.

Http://www.cnblogs.com/dolphin0520/p/3923737.html

The difference between synchronized and lock:

http://houlinyan.iteye.com/blog/1112535

5Lock

Http://www.cnblogs.com/dolphin0520/p/3923167.html

1lock is an interface

2ReentrantLock, which means "reentrant lock", describes the concept of reentrant locking in the next section. Reentrantlock is the only class that implements the lock interface, and Reentrantlock provides more methods.

6ThreadLock

Http://www.cnblogs.com/dolphin0520/p/3920407.html

The Threadlocal class is a copy of a variable that is created for each thread.

7 Synchronizing containers

1) Vector, Stack, HashTable

2) class created by the static factory method provided in the collections class

8 Concurrent containers

Concurrenthashmap,copyonwritearraylist

9 Blocking queues

Arrayblockingqueue,linkedblockingqueue,priorityblockingqueue,delayqueue

In 10java 1.5, the auxiliary classes provided

Countdownlatch,cyclicbarrier,semaphore

11 Thread Pool

11Callable, Future and Futuretask

Thinking in Java (multithreading summary)

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.