This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: Finding the declaring class of a _Jv_Field
- To: Andrew Haley <aph at redhat dot com>
- Subject: Re: Finding the declaring class of a _Jv_Field
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Thu, 02 Nov 2000 23:47:13 +1300
- CC: java-discuss at sources dot redhat dot com
- References: <20001029215123.A10376@klomp.org> <87y9z7wc17.fsf@creche.cygnus.com> <20001029232901.A10928@klomp.org> <39FCB9FC.6225AC55@appnet.com> <20001030234550.A16558@klomp.org> <87zojluaxh.fsf@creche.cygnus.com> <39FF3810.6595000E@appnet.com> <14848.7370.163409.388822@host130.cygnus>
Andrew Haley wrote:
> > http://www.cs.umd.edu/~pugh/java/memoryModel/jsr.html
>
> Interesting doc. Does anyone believe
>
> "A primary concern is the ability of unsophisticated programmers to
> create reliable/correct multithreaded programs."
One of the biggest design mistakes Sun made in the early days of Java was to
try and make so much of the standard libraries thread-safe. Clearly their
intentions were to make it "easier" for people to write multithreaded code.
In reality, not only is this still the single biggest cause of performance
problems in Java code, but it lures naive developers into writing unsafe
code by assuming everything they do is implicitly thread safe. Are Hashtable
and Vector are threadsafe? Not as soon as someone writes (i =
v.indexOf(foo); v.removeElementAt(i)), etc.
They (Sun) realised this mistake later of course: The collections classes
are all unsynchronized, and Swing requires that you do all updates from the
Event dispatch thread. Unfortunately its too late to fix the IO streams and
underlying AWT specifications. You do have to wonder how much better
(faster) swing applications would be today if Swing didn't have so much
legacy synchronized AWT stuff going on underneath it.
regards
[ bryce ]