You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Gurkan Erdogdu <cg...@gmail.com> on 2009/06/26 09:03:41 UTC
Service Manager Thread Safety
Hi;
org.apache.openejb.server.ServiceManager class seems to be not thread-safe.
Is it important?
private static ServiceManager manager;
public static ServiceManager getManager() {
if (manager == null) {
manager = new ServiceManager();
}
return manager;
}
--Gurkan
Re: Service Manager Thread Safety
Posted by David Blevins <da...@visi.com>.
On Jun 26, 2009, at 12:03 AM, Gurkan Erdogdu wrote:
> Hi;
>
> org.apache.openejb.server.ServiceManager class seems to be not
> thread-safe.
> Is it important?
>
> private static ServiceManager manager;
>
> public static ServiceManager getManager() {
> if (manager == null) {
> manager = new ServiceManager();
> }
>
> return manager;
> }
That particular piece of code is only executed at boot time, which is
a single threaded process. But there's certainly no downside to
fixing it. We could probably just eagerly instantiate that object.
-David