You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Jung, Eric" <Er...@Arbella.com> on 2004/09/22 16:46:30 UTC

RE: [Configuration] why is JNDIConfiguration.getContext() private ?

Hi Emmanuel.

I looked at your code changes and have a couple comments:

1. In isEmpty(), can you please call enumeration.close()? See
http://java.sun.com/j2se/1.3/docs/api/javax/naming/NamingEnumeration.html#cl
ose() for info.

2. Now that you are storing a Context as a class member variable, are you
certain that multiple threads won't be accessing this variable
simultaneously? See the notes under "Concurrent Access" at
http://java.sun.com/j2se/1.3/docs/api/javax/naming/Context.html.
Specifically, "A Context instance is not guaranteed to be synchronized
against concurrent access by multiple threads." Typically, to ensure
thread-safety, people either synchronize or simply re-acquire the Context (I
don't have any feedback about which would be more performant). Even though
JNDIConfiguration is read only for now, I wanted to bring this up to get you
thinking about it.

Thanks,
Eric


-----Original Message-----
From: Emmanuel Bourg [mailto:smanux@lfjr.net] 
Sent: Monday, September 20, 2004 8:57 PM
To: Jakarta Commons Developers List
Subject: Re: [Configuration] why is JNDIConfiguration.getContext() private ?


Jung, Eric wrote:

> The reason I think it would be harder is because since Contexts are not
> thread-safe, you shouldn't store the Context from the ctor in a class
> member. You should re-acquire the Context before doing a "set", thus
> guaranteeing thread-safety. However, if only the Context is passed to the
> ctor, you won't have enough information to re-acquire the Context before
> set.

I'm not sure to understand how fetching the context on every "set" will 
make the operation thread safe. Anyway this may not be an issue right 
now since JNDIConfiguration is read only.


> -Eric
> p.s. can you point me to the Jakarta page that details how to supply a
> patch? I know I've seen it before, just can't remember where...also,
should
> I open a bugzilla ticket for this?

Yes you can open a bug for this. I think the page you are looking for is 
this one:

http://jakarta.apache.org/commons/patches.html

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org