This chapter highlights:
Runnable describes a task that can be executed asynchronously
Executor to include runnable instances in the execution plan
Callable describes a task that produces results
You can submit one or more callable instances to executorservice, and when these callable have execution results, merge the results
When multiple threads manipulate shared data without synchronization, the result is unpredictable
Parallel algorithms and thread-safe data structures are better than programming with lock mechanism
Parallel stream and array operations can automatically and safely run compute parallelism
Concurrenthashmap is a thread-safe hash table that allows atoms to update their elements
Atomiclong can be used as an unlocked shared counter, or if the thread is competitive, you can use Longadder
Lock ensures that only one thread executes the critical section at the same time
When an interrupt flag is set or an interruptedexception exception occurs, the Interruptible task should terminate. Long-running tasks should not block the program's UI, but progress and eventual updates need to appear in the UI thread
The Process class allows you to execute commands in a separate process and interact with the input, output, and error streams.
Java core Technology notes for busy people (10, concurrent programming)