Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
BEE MBA PMP SCJP-6
Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
BEE MBA PMP SCJP-6
Jim Hoglund wrote:
It's very tough to get the JVM to swap threads in a particular place
and to another specific place, so I would just accept the risk as real
and do the synchronization. Also, the extra return statement is not
needed. Thanks.
Henry Wong wrote:
Jim Hoglund wrote:
It's very tough to get the JVM to swap threads in a particular place
and to another specific place, so I would just accept the risk as real
and do the synchronization. Also, the extra return statement is not
needed. Thanks.
With modern processors, and how they all have multiple cores, it gets even more complicated. Don't think of it as having context switches that happen at particular locations. With these processors, the threads are truly running in parallel.
Henry
http://plainoldjavaobject.blogspot.in
BEE MBA PMP SCJP-6
Peter Taucher wrote:
Jim Hoglund wrote:Henry : A question. How is the reality of multiprocessors reflected in Java 1.6,
and what do I need to know for about this for SCJP-6? Is it true that physically,
with multiple processors, there may be multiple threads running (with OS magic),
but logically, based on the language spec, thread behavior is as described above?
Jim ......
BEE MBA PMP SCJP-6
BEE MBA PMP SCJP-6
Jim Hoglund wrote:Well I'm confused now. The IBM article by Peter Haggar claims that there is an unresolvable problem
with the singleton pattern.
Jim Hoglund wrote:I suspect his conclusions, however, because the role of object locking in synchronized
methods is not discussed. If the Singleton class object will be locked before getInstance() can even
start, there can be no thread swaps; preventing preemption is the purpose of the lock. Am I missing
something here?
Mike Simmons wrote: they were dreadfully overused ever since the Gang of Four book came out, and in many cases they're unnecessary or even counterproductive.
BEE MBA PMP SCJP-6
Jim Hoglund wrote:So I'm curious about problems with singletons. Why should they be avoided?
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|