< prev index next >

test/java/util/logging/LoggingDeadlock.java

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4994705
  27  *
  28  * @summary deadlock in LogManager
  29  * @author  Serguei Spitsyn / SAP
  30  *
  31  * @build    LoggingDeadlock
  32  * @run  main/timeout=15 LoggingDeadlock




  33  *
  34  * There can be a deadlock between two class initializations.
  35  * It happens if the LogManager.<clinit> and the Logger.<clinit>
  36  * are invoked concurrently on two different threads.
  37  * There is a cyclic dependence between the two static initializers:
  38  *   1. LogManager.<clinit> instantiate the class RootLogger which
  39  *      is a subclass of the Logger class.
  40  *      It requires the Logger class initialization to complete.
  41  *   2. Logger.<clinit> initializes the field "global", so it
  42  *      it makes a call: Logger.getLogger("global").
  43  *      Subsequently the LogManager static method getLogManager()
  44  *      is called which requires the LogManager class
  45  *      initialization to complete.
  46  * This cyclic dependence causes a deadlock, so two class
  47  * initializations are waiting for each other.
  48  * This is a regression test for this bug.
  49  */
  50 
  51 
  52 import java.util.logging.LogManager;




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     4994705
  27  *
  28  * @summary deadlock in LogManager
  29  * @author  Serguei Spitsyn / SAP
  30  *
  31  * @build    LoggingDeadlock
  32  * @run  main/timeout=15 LoggingDeadlock
  33  * @key randomness
  34  */
  35 
  36 /*
  37  *
  38  * There can be a deadlock between two class initializations.
  39  * It happens if the LogManager.<clinit> and the Logger.<clinit>
  40  * are invoked concurrently on two different threads.
  41  * There is a cyclic dependence between the two static initializers:
  42  *   1. LogManager.<clinit> instantiate the class RootLogger which
  43  *      is a subclass of the Logger class.
  44  *      It requires the Logger class initialization to complete.
  45  *   2. Logger.<clinit> initializes the field "global", so it
  46  *      it makes a call: Logger.getLogger("global").
  47  *      Subsequently the LogManager static method getLogManager()
  48  *      is called which requires the LogManager class
  49  *      initialization to complete.
  50  * This cyclic dependence causes a deadlock, so two class
  51  * initializations are waiting for each other.
  52  * This is a regression test for this bug.
  53  */
  54 
  55 
  56 import java.util.logging.LogManager;


< prev index next >