From the book Java Concurrency In Practice: To publish an object safely, both the reference to the object and the object’s state must be made visi ...
From the book Java Concurrency In Practice: To publish an object safely, both the reference to the object and the object’s state must be made visi ...
Looking at the code below Output: I'd like to know if there is an easy way to export the bove output to a CSV, word or excel file. ...
This question came to me after reading this answer. Code example: class Obj1 { int f1 = 0; } volatile Obj1 v1; Obj1 v2; Thread 1 | Th ...
Consider the following Kotlin code: as well the same example rewritten using coroutines: Both examples will work in most cases, and yet both are ...
I am trying to write a test that demonstrates that assigning a new reference to a class' field in a multi-threading environment is not thread-safe and ...
I'm reading "Java concurrency in practice", and it says: To publish an object safely, both the reference to the object and the object's state must ...
I'm reading a book "Java concurrency in practice" by Brian Goetz. Paragraphs 3.5 and 3.5.1 contains statements that I can not understand. Consider th ...
Following is my singleton class where I am using double-checked-locking without using volatile keyword and without synchronizing the entire getInstanc ...
Let's say we have a class and some client code Is it impossible for an AssertionError to be thrown because happens-before is transitive? Even t ...
First off the code, from JCIP listing http://jcip.net/listings/StuffIntoPublic.java and http://jcip.net/listings/Holder.java I am saying that the A ...
When http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#finalRight says The values for an object's final fields are set in its constru ...
Say I have a class and in some client code I do something like and take away the happens-before guarantee for calling Thread Start. Then is it p ...
Say I have this piece of code and in a class called todaySchedule, have a method and here's the Hour class Now, I'm not sure what JSF does ...
First off, I will give links to the source code that I will be talking about since copy/paste would make this question page too long. In Listing 5.15 ...
I have two threads, each has its own counter: thread A has counterA, thread B has counterB. Each thread has to use both counters: thread A has to use ...
By reading Java Concurrency in Practice I can see: To publish an object safely, both the reference to the object and the object's state must be made ...
I know that you can safely publish a non-thread safe object by writing the reference to a final or volatile field which will later be read by exactly ...
Since StringBuffer is thread safe it can safely be published. Consider the public constructor of StringBuffer ( sources ): where super(16) designat ...
I have been reading lately about safe publication of Java objects (e.g. here: http://shipilev.net/blog/2014/safe-public-construction/). Until now I ...
java.lang.String is only effectively immutable. Brian Goetz of "Java Concurrency in Practice" said something like effectively immutable objects will o ...