even 512 way by 2020. Your find yourself ever push to make more use of multiple threads. And the Concurrent API certainly make it easier. Lets have a look at some of the tricks in the new API.
Locks, in old fashioned java, when you had a critical set of code, a piece you want to be sure, only one thread was going to run at a time. You use to have to synchronize it on a object invented for the task. But in Java 5 and onwards have also proper locks in a variatly of types.
Lock myLock = new ReentractLock();
// Thread safe code
The API provide to general interfaces, Lock and ReadWriteLock, and three classes, RentrantLock, RentrantReadWriteLock.ReadLock, RentrantReadWriteLock.WriteLock. Rentrant means the calling class can try and gain the lock as many times as it like without problems, only once it was unlock as many lock as it has acquired will another thread beable to acquire the lock. The RentractReadWriteLock is usually for double end object such as queues, seperate class may be able to gain different locks. Allowing different threads to be reading and writing the queue at the same time.