Get Java Concurrency in Practice now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.
1 Bad way to sort a list. Don't do this.
2 Less than optimal way to sort a list
1.1 Non-thread-safe sequence generator
1.2 Thread-safe sequence generator
2.1 A stateless servlet
2.2 Servlet that counts requests without the necessary synchronization. Don't do this.
2.3 Race condition in lazy initialization. Don't do this.
2.4 Servlet that counts requests using AtomicLong
2.5 Servlet that attempts to cache its last result without adequate atomicity. Don't do this.
2.6 Servlet that caches last result, but with Unacceptably Poor concurrency. Don't do this.
2.7 Code that would deadlock if intrinsic locks were not reentrant
2.8 Servlet that caches its last request and result
3.1 Sharing variables without synchronization. Don't do this.