Re: ThreadPoolExecutor backport



On Jul 31, 2:49 pm, Robert Klemme <shortcut...@xxxxxxxxxxxxxx> wrote:
On 31.07.2008 15:19, Lew wrote:

Philipp wrote:

Btw, AFAIK the implementation you are using preceded Java 5 so it is not
a backport.

Q2: Does it make a difference if you are in the 1.4 or java [sic] 5
memory model?

Yes, but not to this snippet.

Are you sure with regard to "volatile"?  I faintly remember articles
about the flaws of the Java memory model before Java 5 and I believe
volatile handling was one of them.  Or am I mixing up something?

You are correct, but 'volatile' was not used in the snippet, so that
difference is, as stated, not relevant to the snippet.

--
Lew
.



Relevant Pages

  • Re: ThreadPoolExecutor backport
    ... about the flaws of the Java memory model before Java 5 and I believe ... What you are remembering is that 'volatile' prior to Java 5 only ... volatile int flag; ...
    (comp.lang.java.programmer)
  • Re: ThreadPoolExecutor backport
    ... AFAIK the implementation you are using preceded Java 5 so it is not ... a backport. ... but not to this snippet. ... about the flaws of the Java memory model before Java 5 and I believe ...
    (comp.lang.java.programmer)
  • Re: is assignment atomic/thread safe?
    ... Peter Duniho wrote: ... Thomas Pornin wrote: ... If thread B reads the volatile variable, then it will see the change ... To do otherwise would violate Java semantics. ...
    (comp.lang.java.programmer)
  • Re: Thread safe access to elements of a growing array without synchronization
    ... makes volatile useful. ... In the old memory model, ... and reading from a volatile field has the same memory ... almost to the level of synchronization. ...
    (comp.lang.java.programmer)
  • Re: How to use power of Dual/ Quad core Processors in Applet?
    ... synchronization (which also handles memory synchronization between ... Java has a well-defined memory model that the JVM on any system must follow. ... Why would you expect "a lot of Java code to fail due to lack of proper synchronization" in greater proportion on multi-core systems than on single-core systems, given that both have to follow the Java Memory Model? ...
    (comp.lang.java.programmer)