“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… — Brian Goetz Copy Share Image
“From the perspective of a class C, an alien method is one whose behavior is not fully specified by C. This includes methods in… — Brian Goetz Copy Share Image
“Whenever more than one thread accesses a given state variable, and one of them might write to it, they all must coordinate their access… — Brian Goetz Copy Share Image
“Once an object escapes, you have to assume that another class or thread may, maliciously or carelessly, misuse it. This is a compelling reason… — Brian Goetz Copy Share Image
“Just as it is a good practice to make all fields private unless they need greater visibility, it is a good practice to make… — Brian Goetz Copy Share Image
“The possibility of incorrect results in the presence of unlucky timing is so important in concurrent programming that it has a name: a race… — Brian Goetz Copy Share Image
“Accessing shared, mutable data requires using synchronization; one way to avoid this requirement is to not share. If data is only accessed from a… — Brian Goetz Copy Share Image
“Debugging tip: For server applications, be sure to always specify the -server JVM command line switch when invoking the JVM, even for development and… — Brian Goetz Copy Share Image
“Immutable objects are simple. They can only be in one state, which is carefully controlled by the constructor. One of the most difficult elements… — Brian Goetz Copy Share Image
“Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.” — Brian Goetz Copy Share Image
“It is far easier to design a class to be thread-safe than to retrofit it for thread safety later.” — Brian Goetz Copy Share Image
“Sometimes abstraction and encapsulation are at odds with performance — although not nearly as often as many developers believe — but it is always… — Brian Goetz Copy Share Image
“When a field is declared volatile, the compiler and runtime are put on notice that this variable is shared and that operations on it… — Brian Goetz Copy Share Image