The Executor Framework and Thread Pools in Java
An executor separates submitting work from running it, so threads are reused instead of created per task.
Advanced level material.
60 notes tagged
An executor separates submitting work from running it, so threads are reused instead of created per task.
The two failures that define concurrency: results that depend on timing, and threads that wait for each other forever.
Explicit locks offer timeouts, fairness and multiple conditions, and the atomic classes give lock free updates for single variables.
synchronized gives mutual exclusion and visibility. volatile gives visibility only, and knowing the difference prevents most concurrency bugs.
Serialization turns an object graph into bytes and back. It is easy to switch on, hard to maintain, and a genuine security risk.
A parallel stream splits the work across threads. It helps less often than people expect, and it breaks silently when the rules are ignored.
Collectors turn a stream into a collection, a map or a summary, and grouping is where they become genuinely powerful.
Generic type information exists only at compile time. Knowing what the compiler removes explains every generics restriction.
Bounds restrict what a type parameter may be, and wildcards let a method accept a family of parameterised types safely.
Buckets, hashing, collisions and resizing. Understanding the mechanism explains the performance and every rule about keys.
The final build. Everything in the path applied to one real site, with a defined standard it has to meet before it is finished.
Markup is not where security is enforced, and several markup decisions can undermine it entirely. The ones every front end developer should know.