dev@glassfish.java.net

Re: deadlock in LogManager

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Fri, 24 Apr 2009 19:03:38 -0500

Lloyd Chambers wrote:
> I made the change, and so far it has not deadlocked.
Hi, Lloyd. Nice of you to be the multi-core victim to find this!

Synchronizing is probably a solid fix. This is from the Java SE source
code:

    public static *synchronized* Logger getLogger


I know that the java.util.logging.Logger and our Logger are not
identical, but at least as far as this is concerned they're seemingly
close enough.

- Tim
>
>
> llcMP:common llc$ svn diff common-util
> Index: common-util/src/main/java/com/sun/logging/LogDomains.java
> ===================================================================
> --- common-util/src/main/java/com/sun/logging/LogDomains.java
> (revision 26614)
> +++ common-util/src/main/java/com/sun/logging/LogDomains.java (working
> copy)
> @@ -241,7 +241,7 @@
> * @return
> */
>
> - public static Logger getLogger(final Class clazz, final String
> name) {
> + public static synchronized Logger getLogger(final Class clazz,
> final String name) {
> final ClassLoader cloader =clazz.getClassLoader();
> Logger l = LogManager.getLogManager().getLogger(name);
>
>
>
> Lloyd