...
Wiki Markup |
---|
*alien method* 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 overridable methods (neither private nor final) in C itself \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
Wiki Markup |
---|
*condition predicate* An expression constructed from the state variables of a class that must be true for a thread to continue execution. The thread pauses execution, via {{Object.wait()}}, {{Thread.sleep()}}, or some other mechanism, and is resumed later, presumably when the requirement is true and when it is notified \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
Wiki Markup |
---|
It is technically possible to have an immutable object without all fields being final. {{String}} is such a class but this relies on delicate reasoning about benign data races that requires a deep understanding of the Java Memory Model. (For the curious: {{String}} lazily computes the hash code the first time {{hashCode}} is called and caches it in a nonfinal field, but this works only because that field can take on only one nondefault value that is the same every time it is computed because it is derived deterministically from immutable state.) \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
Wiki Markup |
---|
*interruption policy* An interruption policy determines how a thread interprets an interruption request -- what it does (if anything) when one is detected, what units of work are considered atomic with respect to interruption, and how quickly it reacts to interruption \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
Wiki Markup |
---|
*publishing objects* Publishing an object means making it available to code outside of its current scope, such as by storing a reference to it where other code can find it, returning it from a nonprivate method, or passing it to a method in another class \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
Wiki Markup |
---|
*race condition* "General races cause nondeterministic execution and are failures in programs intended to be deterministic" \[[Netzer 1992|AA. References#Netzer 92]\]. "A race condition occurs when the correctness of a computation depends on the relative timing or interleaving of multiple threads by the runtime" \[[Goetz 20062006a|AA. References#Goetz 06]\]. |
...
- Initializing an object reference from a static initializer.
- Storing a reference to it into a volatile field.
- Storing a reference to it into a final field.
Wiki Markup Storing a reference to it into a field that is properly guarded by a (_synchronized_) lock. \[[Goetz 20062006a, Section 3.5 "Safe Publication"|AA. References#Goetz 06]\]
...
Wiki Markup |
---|
*thread-safe* An object is thread-safe if it can be shared by multiple threads without the possibility of any data races. "A thread-safe object performs synchronization internally, so multiple threads can freely access it through its public interface without further synchronization" \[[Goetz 20062006a|AA. References#Goetz 06]\]. Immutable classes are thread-safe by definition. Mutable classes may also be thread-safe if they are properly synchronized. |
...