Skip to Content
Functional Programming in Java
book

Functional Programming in Java

by Venkat Subramaniam
February 2014
Intermediate to advanced
160 pages
4h 59m
English
Pragmatic Bookshelf
Content preview from Functional Programming in Java

Managing Locks

Locks play a critical part in concurrent Java applications. In this section we’ll use lambda expressions to gain finer control over locks and open the doors to unit-test the proper locking of critical sections.

synchronized is an age-old keyword used to provide mutual exclusion. A synchronized block of code, such as synchronized { ... }, is a realization of the execute around method pattern. This pattern has been around since Java 1.0, but it was restricted and bound to the synchronized keyword in Java. Lambda expressions have now unleashed this pattern’s power.

synchronized has some shortcomings—see Java Concurrency in Practice [Goe06], by Brian Goetz, and Programming Concurrency on the JVM [Sub11]. First, it’s hard to time ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Functional Programming in Java

Functional Programming in Java

Pierre-Yves Saumont

Publisher Resources

ISBN: 9781941222690Errata Page