test/java/util/logging/LoggingDeadlock2.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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     6467152 6716076 6829503
  27  * @summary deadlock occurs in LogManager initialization and JVM termination
  28  * @author  Serguei Spitsyn / Hitachi / Martin Buchholz
  29  *
  30  * @build    LoggingDeadlock2
  31  * @run  main/timeout=15 LoggingDeadlock2
  32  *
  33  * There is a clear deadlock between LogManager.<clinit> and
  34  * Cleaner.run() methods.
  35  * T1 thread:
  36  *   The LogManager.<clinit> creates LogManager.manager object,
  37  *   sets shutdown hook with the Cleaner class and then waits
  38  *   to lock the LogManager.manager monitor.
  39  * T2 thread:
  40  *   It is started by the System.exit() as shutdown hook thread.
  41  *   It locks the LogManager.manager monitor and then calls the
  42  *   static methods of the LogManager class (in this particular
  43  *   case it is a trick of the inner classes implementation).
  44  *   It is waits when the LogManager.<clinit> is completed.
  45  *
  46  * This is a regression test for this bug.
  47  */
  48 
  49 import java.util.Arrays;
  50 import java.util.List;
  51 import java.util.Random;




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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     6467152 6716076 6829503
  27  * @summary deadlock occurs in LogManager initialization and JVM termination
  28  * @author  Serguei Spitsyn / Hitachi / Martin Buchholz
  29  *
  30  * @build    LoggingDeadlock2
  31  * @run  main LoggingDeadlock2
  32  *
  33  * There is a clear deadlock between LogManager.<clinit> and
  34  * Cleaner.run() methods.
  35  * T1 thread:
  36  *   The LogManager.<clinit> creates LogManager.manager object,
  37  *   sets shutdown hook with the Cleaner class and then waits
  38  *   to lock the LogManager.manager monitor.
  39  * T2 thread:
  40  *   It is started by the System.exit() as shutdown hook thread.
  41  *   It locks the LogManager.manager monitor and then calls the
  42  *   static methods of the LogManager class (in this particular
  43  *   case it is a trick of the inner classes implementation).
  44  *   It is waits when the LogManager.<clinit> is completed.
  45  *
  46  * This is a regression test for this bug.
  47  */
  48 
  49 import java.util.Arrays;
  50 import java.util.List;
  51 import java.util.Random;