This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Finding the declaring class of a _Jv_Field


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 ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]