“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a single thread, no synchronization is needed. This technique, thread confinement, is one of the simplest ways to achieve thread safety. When an object is confined to a thread, such usage is automatically thread-safe even if the confined object itself is not.”
― Java Concurrency in Practice
― Java Concurrency in Practice
“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and testing. The server JVM performs more optimization than the client JVM, such as hoisting variables out of a loop that are not modified in the loop; code that might appear to work in the development environment (client JVM) can break in the deployment environment (server JVM).”
― Java Concurrency in Practice
― Java Concurrency in Practice
“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make all fields final unless they need to be mutable.”
― Java Concurrency in Practice
― Java Concurrency in Practice
“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in other classes as well as overrideable methods (neither private nor final) in C itself. Passing an object to an alien method must also be considered publishing that object. Since you can’t know what code will actually be invoked, you don’t know that the alien method won’t publish the object or retain a reference to it that might later be used from another thread.”
― Java Concurrency in Practice
― Java Concurrency in Practice
“Good uses of volatile variables include ensuring the visibility of their own state, that of the object they refer to, or indicating that an important lifecycle event (such as initialization or shutdown) has occurred.”
― Java Concurrency in Practice
― Java Concurrency in Practice
Puneeth’s 2025 Year in Books
Take a look at Puneeth’s Year in Books, including some fun facts about their reading.
Favorite Genres
Polls voted on by Puneeth
Lists liked by Puneeth





