Right, but there's no need for an external lib, when you can just do:

Collections.synchronizedMap(new HashMap())

Jason
-----Original Message-----
From: Dick Zetterberg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 7:30 AM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Bug catching contest...

> 
> Actually this code wouldn't fix anything. The difference is that this
code
> is visibly not synchronized, while the previous code was unvisibly not
> synchronized.
> 
> The point is that to make it working, both get and put must be in the
same
> synchronized block. Otherwise you may just leave it unsynchronized. In
> fact - this code would probably work well even not synchronized. It
would
> sometimes do unnecessary compilations.
> 
> -- Mike

I know that the code I posted could possibly do unnecessary
compilations.
However I thought that the reason for your complaints was that in the
end a non-threadsafe HashMap was used in the original code. Having both
get and put being done to it from many threads could possibly lead to
more serious errors than just an unnecessary compilation, isn't that so?

And for that reason I suggested the ConcurrentHashMap (rather than a
Hashtable or similar) to avoid synchronization congestion.

Cheers,

Dick Zetterberg
[EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to