< prev index next >

test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java

Print this page
rev 59103 : imported patch hotspot


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 import java.lang.management.*;
  24 
  25 /*
  26  * @test
  27  * @bug     8205878 8206954
  28  * @requires os.family != "windows" & os.family != "solaris"
  29  * @summary Basic test of Thread and ThreadMXBean queries on a natively
  30  *          attached thread that has failed to detach before terminating.
  31  * @comment The native code only supports POSIX so no windows testing; also
  32  *          we have to skip solaris as a terminating thread that fails to
  33  *          detach will hit an infinite loop due to TLS destructor issues - see
  34  *          comments in JDK-8156708
  35  * @run main/othervm/native TestTerminatedThread
  36  */
  37 
  38 public class TestTerminatedThread {
  39 
  40     static native Thread createTerminatedThread();
  41 
  42     static {
  43         System.loadLibrary("terminatedThread");
  44     }
  45 
  46     private static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  47 
  48     public static void main(String[] args) throws Throwable {
  49 
  50         Thread t = createTerminatedThread();
  51 
  52         if (!t.isAlive())
  53             throw new Error("Thread is only supposed to terminate at native layer!");
  54 




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 import java.lang.management.*;
  24 
  25 /*
  26  * @test
  27  * @bug     8205878 8206954
  28  * @requires os.family != "windows"
  29  * @summary Basic test of Thread and ThreadMXBean queries on a natively
  30  *          attached thread that has failed to detach before terminating.
  31  * @comment The native code only supports POSIX so no windows testing



  32  * @run main/othervm/native TestTerminatedThread
  33  */
  34 
  35 public class TestTerminatedThread {
  36 
  37     static native Thread createTerminatedThread();
  38 
  39     static {
  40         System.loadLibrary("terminatedThread");
  41     }
  42 
  43     private static ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  44 
  45     public static void main(String[] args) throws Throwable {
  46 
  47         Thread t = createTerminatedThread();
  48 
  49         if (!t.isAlive())
  50             throw new Error("Thread is only supposed to terminate at native layer!");
  51 


< prev index next >