on 9/27/2000 4:27 PM, "Paul O'Leary" <[EMAIL PROTECTED]> wrote:
> public Screen getInstance (String name)
> throws Exception
> {
> Screen screen = null;
> try
> {
> if ( cache() && this.containsKey ( name ) )
> {
> screen = ( Screen ) this.get ( name );
> }
> else
>
> ScreenLoader is a GenericLoader is a Hashtable. Screen loader should
> probably sync on *this* or just have synced methods to protect its cache.
> This is something of a trivial example because it's not clear if threading
> problems could ever cause a noticeable bug here. But when I see this type
> of stuff a always go looking for other problems in similar modules.
>
> I can go through it and submit some patches for the current code or wait for
> Leon, et al's changes...?
>
> PaulO.
Yep. You are right. For some reason, I always thought that get() and
containsKey() were sync'd methods and couldn't understand why we would need
to do that...I just looked at the javadoc and realized they are not. Oh
wait...reading further...Hashtable in 1.2 IS sync'd so this could only be an
issue in 1.1 JVM's, right?
Now that we don't have JDK 1.1 requirements anymore, we should just change
things to use Collections and do this properly anyway.
-jon
--
http://scarab.tigris.org/ | http://noodle.tigris.org/
http://java.apache.org/ | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/ | http://www.sourcexchange.com/
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]