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
24 /*
25 * @test
26 * @bug 4530538
27 * @summary Basic unit test of ThreadMXBean.getAllThreadIds()
28 * @author Alexei Guibadoulline and Mandy Chung
29 *
30 * @run main/othervm AllThreadIds
31 */
32
33 import java.lang.management.*;
34 import java.util.concurrent.Phaser;
35
36 public class AllThreadIds {
37 final static int DAEMON_THREADS = 20;
38 final static int USER_THREADS = 5;
39 final static int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
40 private static final boolean live[] = new boolean[ALL_THREADS];
41 private static final Thread allThreads[] = new Thread[ALL_THREADS];
42 private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
43 private static boolean testFailed = false;
44 private static boolean trace = false;
45
46 private static long prevTotalThreadCount = 0;
47 private static int prevLiveThreadCount = 0;
48 private static int prevPeakThreadCount = 0;
49 private static long curTotalThreadCount = 0;
|
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
24 /*
25 * @test
26 * @bug 4530538
27 * @summary Basic unit test of ThreadMXBean.getAllThreadIds()
28 * @author Alexei Guibadoulline and Mandy Chung
29 *
30 * @modules java.management
31 * @run main/othervm AllThreadIds
32 */
33
34 import java.lang.management.*;
35 import java.util.concurrent.Phaser;
36
37 public class AllThreadIds {
38 final static int DAEMON_THREADS = 20;
39 final static int USER_THREADS = 5;
40 final static int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
41 private static final boolean live[] = new boolean[ALL_THREADS];
42 private static final Thread allThreads[] = new Thread[ALL_THREADS];
43 private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
44 private static boolean testFailed = false;
45 private static boolean trace = false;
46
47 private static long prevTotalThreadCount = 0;
48 private static int prevLiveThreadCount = 0;
49 private static int prevPeakThreadCount = 0;
50 private static long curTotalThreadCount = 0;
|