Path: blob/master/test/jdk/java/lang/management/CompositeData/ThreadInfoCompositeData.java
41152 views
/*1* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 4982289 819825326* @summary Test ThreadInfo.from to return a valid27* ThreadInfo object. Or throw exception if28* the input CompositeData is invalid.29* @author Mandy Chung30*31* @modules java.management/sun.management32* @build ThreadInfoCompositeData OpenTypeConverter33* @run testng/othervm ThreadInfoCompositeData34*/353637import javax.management.openmbean.*;38import java.lang.management.LockInfo;39import java.lang.management.MonitorInfo;40import java.lang.management.ThreadInfo;41import java.util.Arrays;42import java.util.Objects;43import java.util.stream.Stream;4445import org.testng.annotations.Test;46import static org.testng.Assert.*;4748public class ThreadInfoCompositeData {49private static String lockClassName = "myClass";50private static int lockIdentityHashCode = 123456;51private static String lockName = lockClassName + '@' +52Integer.toHexString(lockIdentityHashCode);53private static LockInfo lockInfo =54new LockInfo(lockClassName, lockIdentityHashCode);5556@Test57public static void createGoodCompositeData() throws Exception {58CompositeData cd = Factory.makeThreadInfoCompositeData();59ThreadInfo info = ThreadInfo.from(cd);60checkThreadInfo(info);61}6263/*64* An invalid CompositeData with JDK 9 attributes but missing JDK 6 attributes65*/66@Test67public static void badMissingCompositeData() throws Exception {68CompositeData cd = Factory.makeCompositeDataMissingV6();69try {70ThreadInfo info = ThreadInfo.from(cd);71throw new RuntimeException("IllegalArgumentException not thrown");72} catch (IllegalArgumentException e) {}73}7475static final StackTraceElement STE =76new StackTraceElement("FooClass", "getFoo", "Foo.java", 100);777879/*80* Current version of ThreadInfo but an older version of StackTraceElement81*/82@Test83public static void withV5StackTraceCompositeData() throws Exception {84CompositeData cd = Factory.makeThreadInfoWithV5StackTrace();85try {86ThreadInfo info = ThreadInfo.from(cd);87throw new RuntimeException("IllegalArgumentException not thrown");88} catch (IllegalArgumentException e) {}89}9091/*92* Current version of ThreadInfo but an older version of MonitorInfo93* and the value of "lockedStackFrame" attribute is null.94*/95@Test96public static void withInvalidMonitorInfoCompositeData() throws Exception {97CompositeData cd = Factory.makeThreadInfoWithIncompatibleMonitorInfo();9899// verify MonitorInfo is valid100CompositeData[] monitors = (CompositeData[])cd.get("lockedMonitors");101CompositeData ste = (CompositeData)monitors[0].get("lockedStackFrame");102if (((Integer)monitors[0].get("lockedStackDepth")) >= 0 || ste != null) {103throw new RuntimeException("Expected negative stack depth and null stack frame");104}105MonitorInfo minfo = MonitorInfo.from(monitors[0]);106checkLockInfo(minfo);107if (minfo.getLockedStackFrame() != null) {108throw new RuntimeException("Expected null stack frame");109}110111try {112ThreadInfo info = ThreadInfo.from(cd);113throw new RuntimeException("IllegalArgumentException not thrown");114} catch (IllegalArgumentException e) {}115}116117/*118* ThreadInfo of version N can accept lockedMonitors of version >= N119*/120@Test121public static void withNewMonitorInfoCompositeData() throws Exception {122CompositeData cd = Factory.makeThreadInfoWithNewMonitorInfo();123ThreadInfo info = ThreadInfo.from(cd);124checkThreadInfo(info);125}126127/*128* Test CompositeData representing JDK 5 ThreadInfo129*/130@Test131public static void createV5ThreadInfo() throws Exception {132CompositeData cd = Factory.makeThreadInfoV5CompositeData();133ThreadInfo info = ThreadInfo.from(cd);134checkThreadInfoV5(info);135}136137/*138* Test ThreadInfoCompositeData.toCompositeData139*/140@Test141public static void internalToCompositeData() throws Exception {142CompositeData cd = Factory.makeThreadInfoCompositeData();143ThreadInfo info = ThreadInfo.from(cd);144cd = sun.management.ThreadInfoCompositeData.toCompositeData(info);145info = ThreadInfo.from(cd);146checkThreadInfo(info);147}148149static void checkThreadInfoV5(ThreadInfo info) {150Object[] values = Factory.VALUES;151152if (info.getThreadId() != ((Long) values[THREAD_ID]).longValue()) {153throw new RuntimeException("Thread Id = " + info.getThreadId() +154" expected = " + values[THREAD_ID]);155}156if (!info.getThreadName().equals(values[THREAD_NAME])) {157throw new RuntimeException("Thread Name = " +158info.getThreadName() + " expected = " + values[THREAD_NAME]);159}160if (info.getThreadState() != Thread.State.RUNNABLE) {161throw new RuntimeException("Thread Name = " +162info.getThreadName() + " expected = " + Thread.State.RUNNABLE);163}164if (info.getBlockedTime() != ((Long) values[BLOCKED_TIME]).longValue()) {165throw new RuntimeException("blocked time = " +166info.getBlockedTime() +167" expected = " + values[BLOCKED_TIME]);168}169if (info.getBlockedCount() != ((Long) values[BLOCKED_COUNT]).longValue()) {170throw new RuntimeException("blocked count = " +171info.getBlockedCount() +172" expected = " + values[BLOCKED_COUNT]);173}174if (info.getWaitedTime() != ((Long) values[WAITED_TIME]).longValue()) {175throw new RuntimeException("waited time = " +176info.getWaitedTime() +177" expected = " + values[WAITED_TIME]);178}179if (info.getWaitedCount() != ((Long) values[WAITED_COUNT]).longValue()) {180throw new RuntimeException("waited count = " +181info.getWaitedCount() +182" expected = " + values[WAITED_COUNT]);183}184if (!info.getLockName().equals(values[LOCK_NAME])) {185throw new RuntimeException("Lock Name = " +186info.getLockName() + " expected = " + values[LOCK_NAME]);187}188if (info.getLockOwnerId() !=189((Long) values[LOCK_OWNER_ID]).longValue()) {190throw new RuntimeException(191"LockOwner Id = " + info.getLockOwnerId() +192" expected = " + values[LOCK_OWNER_ID]);193}194if (!info.getLockOwnerName().equals(values[LOCK_OWNER_NAME])) {195throw new RuntimeException("LockOwner Name = " +196info.getLockOwnerName() + " expected = " +197values[LOCK_OWNER_NAME]);198}199200checkStackTrace(info.getStackTrace());201checkLockInfo(info.getLockInfo());202}203204static void checkThreadInfo(ThreadInfo info) {205Object[] values = Factory.VALUES;206207checkThreadInfoV5(info);208209if (!values[DAEMON].equals(info.isDaemon())) {210throw new RuntimeException("Daemon = " +211info.isDaemon() + " expected = " + values[DAEMON]);212}213}214215private static void checkStackTrace(StackTraceElement[] s) {216if (s.length != 1) {217throw new RuntimeException("Stack Trace length = " +218s.length + " expected = 1");219}220221StackTraceElement s1 = STE;222StackTraceElement s2 = s[0];223224// these attributes may be null225if (!Objects.equals(s1.getClassLoaderName(), s2.getClassLoaderName())) {226throw new RuntimeException("Class loader name = " +227s2.getClassLoaderName() + " expected = " + s1.getClassLoaderName());228}229if (!Objects.equals(s1.getModuleName(), s2.getModuleName())) {230throw new RuntimeException("Module name = " +231s2.getModuleName() + " expected = " + s1.getModuleName());232}233if (!Objects.equals(s1.getModuleVersion(), s2.getModuleVersion())) {234throw new RuntimeException("Module version = " +235s2.getModuleVersion() + " expected = " + s1.getModuleVersion());236}237238if (!s1.getClassName().equals(s2.getClassName())) {239throw new RuntimeException("Class name = " +240s2.getClassName() + " expected = " + s1.getClassName());241}242if (!s1.getMethodName().equals(s2.getMethodName())) {243throw new RuntimeException("Method name = " +244s2.getMethodName() + " expected = " + s1.getMethodName());245}246if (!s1.getFileName().equals(s2.getFileName())) {247throw new RuntimeException("File name = " +248s2.getFileName() + " expected = " + s1.getFileName());249}250if (s1.getLineNumber() != s2.getLineNumber()) {251throw new RuntimeException("Line number = " +252s2.getLineNumber() + " expected = " + s1.getLineNumber());253}254}255256private static void checkLockInfo(LockInfo li) {257if (!li.getClassName().equals(lockInfo.getClassName())) {258throw new RuntimeException("Class Name = " +259li.getClassName() + " expected = " + lockInfo.getClassName());260}261if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) {262throw new RuntimeException("Class Name = " +263li.getIdentityHashCode() + " expected = " +264lockInfo.getIdentityHashCode());265}266}267268@Test269public static void badNameCompositeData() throws Exception {270CompositeData cd = Factory.makeCompositeDataWithBadNames();271try {272ThreadInfo info = ThreadInfo.from(cd);273throw new RuntimeException("IllegalArgumentException not thrown");274} catch (IllegalArgumentException e) { }275}276277@Test278public static void badTypeCompositeData() throws Exception {279CompositeData cd = Factory.makeCompositeDataWithBadTypes();280281try {282ThreadInfo info = ThreadInfo.from(cd);283throw new RuntimeException("IllegalArgumentException not thrown");284} catch (IllegalArgumentException e) { }285}286287private static final int THREAD_ID = 0;288private static final int THREAD_NAME = 1;289private static final int THREAD_STATE = 2;290private static final int BLOCKED_TIME = 3;291private static final int BLOCKED_COUNT = 4;292private static final int WAITED_TIME = 5;293private static final int WAITED_COUNT = 6;294private static final int LOCK_NAME = 7;295private static final int LOCK_OWNER_ID = 8;296private static final int LOCK_OWNER_NAME = 9;297private static final int STACK_TRACE = 10;298private static final int SUSPENDED = 11;299private static final int IN_NATIVE = 12;300// JDK 6 ThreadInfo attributes301private static final int LOCK_INFO = 13;302private static final int LOCKED_MONITORS = 14;303private static final int LOCKED_SYNCS = 15;304// JDK 9 ThreadInfo attributes305private static final int DAEMON = 16;306private static final int PRIORITY = 17;307308private static class Factory {309310static final CompositeType STE_COMPOSITE_TYPE;311static final CompositeType LOCK_INFO_COMPOSITE_TYPE;312static final CompositeType MONITOR_INFO_COMPOSITE_TYPE;313static final ArrayType STE_ARRAY_COMPOSITE_TYPE;314static final ArrayType LOCK_INFO_ARRAY_COMPOSITE_TYPE;315static final ArrayType MONITOR_INFO_ARRAY_COMPOSITE_TYPE;316317static {318CompositeType steCType = null;319CompositeType lockInfoCType = null;320CompositeType monitorInfoCType = null;321ArrayType steArrayType = null;322ArrayType lockInfoArrayType = null;323ArrayType monitorInfoArrayType = null;324325try {326steCType = (CompositeType) OpenTypeConverter.toOpenType(StackTraceElement.class);327lockInfoCType = (CompositeType) OpenTypeConverter.toOpenType(LockInfo.class);328monitorInfoCType = (CompositeType) OpenTypeConverter.toOpenType(MonitorInfo.class);329steArrayType = new ArrayType(1, steCType);330lockInfoArrayType = new ArrayType(1, lockInfoCType);331monitorInfoArrayType = new ArrayType(1, monitorInfoCType);332} catch (Exception e) {333throw new RuntimeException(e);334}335STE_COMPOSITE_TYPE = steCType;336LOCK_INFO_COMPOSITE_TYPE = lockInfoCType;337MONITOR_INFO_COMPOSITE_TYPE = monitorInfoCType;338STE_ARRAY_COMPOSITE_TYPE = steArrayType;339LOCK_INFO_ARRAY_COMPOSITE_TYPE = lockInfoArrayType;340MONITOR_INFO_ARRAY_COMPOSITE_TYPE = monitorInfoArrayType;341}342343static CompositeData makeThreadInfoCompositeData() throws OpenDataException {344CompositeType ct = new CompositeType("MyCompositeType",345"CompositeType for ThreadInfo",346ITEM_NAMES,347ITEM_NAMES,348ITEM_TYPES);349return new CompositeDataSupport(ct, ITEM_NAMES, VALUES);350}351352static CompositeData makeThreadInfoV5CompositeData() throws OpenDataException {353CompositeType ct = new CompositeType("MyCompositeType",354"CompositeType for JDK 5 ThreadInfo",355V5_ITEM_NAMES,356V5_ITEM_NAMES,357V5_ITEM_TYPES);358return new CompositeDataSupport(ct, V5_ITEM_NAMES, V5_VALUES);359}360361static CompositeData makeCompositeDataWithBadTypes() throws OpenDataException {362OpenType[] badItemTypes = {363SimpleType.LONG,364SimpleType.STRING,365SimpleType.STRING,366SimpleType.LONG,367SimpleType.LONG,368SimpleType.LONG,369SimpleType.LONG,370SimpleType.STRING,371SimpleType.LONG,372SimpleType.STRING,373SimpleType.LONG, // bad type374SimpleType.BOOLEAN,375SimpleType.BOOLEAN,376SimpleType.LONG, // bad type377SimpleType.LONG, // bad type378SimpleType.LONG, // bad type379SimpleType.BOOLEAN,380SimpleType.INTEGER,381};382383CompositeType ct =384new CompositeType("Bad item types",385"CompositeType for ThreadInfo",386ITEM_NAMES,387ITEM_NAMES,388badItemTypes);389390// Copy before mutating to avoid affecting other tests.391Object[] localValues = VALUES.clone();392393// patch values[STACK_TRACE] to Long394localValues[STACK_TRACE] = Long.valueOf(1000);395localValues[LOCK_INFO] = Long.valueOf(1000);396localValues[LOCKED_MONITORS] = Long.valueOf(1000);397localValues[LOCKED_SYNCS] = Long.valueOf(1000);398return new CompositeDataSupport(ct, ITEM_NAMES, localValues);399}400401static CompositeData makeCompositeDataWithBadNames() throws OpenDataException {402String[] badItemNames = ITEM_NAMES.clone();403badItemNames[STACK_TRACE] = "BadStackTrace"; // bad item name404405CompositeType ct = new CompositeType("Bad item names",406"CompositeType for ThreadInfo",407badItemNames,408badItemNames,409ITEM_TYPES);410return new CompositeDataSupport(ct,411badItemNames,412VALUES);413}414415/*416* Create a CompositeData of ThreadInfo without JDK 6 attributes417*/418static CompositeData makeCompositeDataMissingV6() throws OpenDataException {419String[] itemNames = concat(V5_ITEM_NAMES, V9_ITEM_NAMES).toArray(String[]::new);420OpenType[] itemTypes = concat(V5_ITEM_TYPES, V9_ITEM_TYPES).toArray(OpenType[]::new);421Object[] values = concat(V5_VALUES, V9_VALUES).toArray(Object[]::new);422423CompositeType ct =424new CompositeType("InvalidCompositeType",425"CompositeType for ThreadInfo",426itemNames,427itemNames,428itemTypes);429return new CompositeDataSupport(ct, itemNames, values);430}431432static CompositeData makeStackTraceElement() {433Object[] steValue = {434STE.getClassLoaderName(),435STE.getModuleName(),436STE.getModuleVersion(),437STE.getClassName(),438STE.getMethodName(),439STE.getFileName(),440Integer.valueOf(STE.getLineNumber()),441Boolean.valueOf(STE.isNativeMethod()),442};443444try {445return new CompositeDataSupport(STE_COMPOSITE_TYPE,446STE_ITEM_NAMES,447steValue);448} catch (OpenDataException e) {449throw new RuntimeException(e);450}451}452453static CompositeData makeStackTraceElementV5() throws OpenDataException {454CompositeType steV5CType =455new CompositeType("JDK 5 StackTraceElement",456"CompositeType for JDK 5 StackTraceElement",457STE_V5_ITEM_NAMES,458STE_V5_ITEM_NAMES,459STE_V5_ITEM_TYPES);460461Object[] steV5Value = {462STE.getClassName(),463STE.getMethodName(),464STE.getFileName(),465Integer.valueOf(STE.getLineNumber()),466Boolean.valueOf(STE.isNativeMethod()),467};468469return new CompositeDataSupport(steV5CType, STE_V5_ITEM_NAMES, steV5Value);470}471472/*473* Create a CompositeData of ThreadInfo without JDK 5 StackTraceElement474*/475static CompositeData makeThreadInfoWithV5StackTrace() throws OpenDataException {476OpenType[] badTypes = ITEM_TYPES.clone();477Object[] badValues = VALUES.clone();478479CompositeData[] stackTrace = new CompositeData[1];480stackTrace[0] = makeStackTraceElementV5();481badTypes[STACK_TRACE] = new ArrayType(1, stackTrace[0].getCompositeType());482badValues[STACK_TRACE] = stackTrace;483CompositeType ct = new CompositeType("CompositeType",484"ThreadInfo with JDK 5 StackTraceElement",485ITEM_NAMES,486ITEM_NAMES,487badTypes);488return new CompositeDataSupport(ct, ITEM_NAMES, badValues);489}490491/*492* Create MonitorInfo with JDK 5 StackTraceElement (i.e. JDK 6 MonitorInfo)493* The value of "lockedStackFrame" attribute is null to ensure that494* the validation is done.495*/496static CompositeData makeV6MonitorInfo() throws OpenDataException {497CompositeData steV5 = makeStackTraceElementV5();498499String[] names = MONITOR_INFO_COMPOSITE_TYPE.keySet().toArray(new String[0]);500OpenType[] types = new OpenType[names.length];501for (int i=0; i < names.length; i++) {502String n = names[i];503types[i] = "lockedStackFrame".equals(n)504? steV5.getCompositeType()505: MONITOR_INFO_COMPOSITE_TYPE.getType(n);506}507508CompositeType ctype =509new CompositeType("JDK 6 MonitorInfo",510"CompositeType for JDK 6 MonitorInfo",511names,512names,513types);514515Object[] values = {516lockClassName,517lockIdentityHashCode,518-1,519null520};521522return new CompositeDataSupport(ctype, names, values);523}524525/*526* Create a CompositeData of ThreadInfo with incompatible MonitorInfo527*/528static CompositeData makeThreadInfoWithIncompatibleMonitorInfo() throws OpenDataException {529OpenType[] badTypes = ITEM_TYPES.clone();530Object[] badValues = VALUES.clone();531532CompositeData[] lockedMonitors = new CompositeData[1];533lockedMonitors[0] = makeV6MonitorInfo();534badTypes[LOCKED_MONITORS] = new ArrayType(1, lockedMonitors[0].getCompositeType());535badValues[LOCKED_MONITORS] = lockedMonitors;536CompositeType ct = new CompositeType("CompositeType",537"ThreadInfo with incompatible MonitorInfo",538ITEM_NAMES,539ITEM_NAMES,540badTypes);541return new CompositeDataSupport(ct, ITEM_NAMES, badValues);542}543544static CompositeData makeNewMonitorInfo() throws OpenDataException {545String[] names = Stream.concat(MONITOR_INFO_COMPOSITE_TYPE.keySet().stream(),546Stream.of("extra")).toArray(String[]::new);547OpenType[] types = new OpenType[names.length];548for (int i=0; i < names.length; i++) {549String n = names[i];550types[i] = "extra".equals(n)551? SimpleType.STRING552: MONITOR_INFO_COMPOSITE_TYPE.getType(n);553}554555CompositeType compositeType =556new CompositeType("JDK X MonitorInfo",557"CompositeType for JDK X MonitorInfo",558names,559names,560types);561562Object[] values = {563lockClassName,564lockIdentityHashCode,565Integer.valueOf(1),566makeStackTraceElement(),567"extra"568};569570return new CompositeDataSupport(compositeType, names, values);571}572573/*574* Create a CompositeData of ThreadInfo with a newer version of MonitorInfo575*/576static CompositeData makeThreadInfoWithNewMonitorInfo() throws OpenDataException {577OpenType[] types = ITEM_TYPES.clone();578Object[] badValues = VALUES.clone();579580CompositeData[] lockedMonitors = new CompositeData[1];581lockedMonitors[0] = makeNewMonitorInfo();582types[LOCKED_MONITORS] = new ArrayType(1, lockedMonitors[0].getCompositeType());583badValues[LOCKED_MONITORS] = lockedMonitors;584CompositeType ct = new CompositeType("CompositeType",585"ThreadInfo with JDK 5 MonitorInfo",586ITEM_NAMES,587ITEM_NAMES,588types);589return new CompositeDataSupport(ct, ITEM_NAMES, badValues);590}591592static CompositeData makeLockInfo() {593Object[] lockInfoValue = {594lockInfo.getClassName(),595lockInfo.getIdentityHashCode(),596};597598try {599return new CompositeDataSupport(LOCK_INFO_COMPOSITE_TYPE,600LOCK_INFO_ITEM_NAMES,601lockInfoValue);602} catch (OpenDataException e) {603throw new RuntimeException(e);604}605}606607static CompositeData[] makeLockedSynchronizers() {608CompositeData[] lockedSyncs = new CompositeData[1];609lockedSyncs[0] = makeLockInfo();610return lockedSyncs;611}612613static CompositeData[] makeLockedMonitors() {614CompositeData[] lockedMonitorsCD = new CompositeData[1];615616Object[] lockedMonitorsValue = {617lockInfo.getClassName(),618lockInfo.getIdentityHashCode(),619makeStackTraceElement(),620Integer.valueOf(1),621};622try {623lockedMonitorsCD[0] =624new CompositeDataSupport(MONITOR_INFO_COMPOSITE_TYPE,625LOCKED_MONITORS_ITEM_NAMES,626lockedMonitorsValue);627} catch (OpenDataException e) {628throw new RuntimeException(e);629}630return lockedMonitorsCD;631}632633static final String[] V5_ITEM_NAMES = {634"threadId",635"threadName",636"threadState",637"blockedTime",638"blockedCount",639"waitedTime",640"waitedCount",641"lockName",642"lockOwnerId",643"lockOwnerName",644"stackTrace",645"suspended",646"inNative",647};648649static final String[] V6_ITEM_NAMES = {650"lockInfo",651"lockedMonitors",652"lockedSynchronizers",653};654655static final String[] V9_ITEM_NAMES = {656"daemon",657"priority",658};659660static final OpenType[] V5_ITEM_TYPES = {661SimpleType.LONG,662SimpleType.STRING,663SimpleType.STRING,664SimpleType.LONG,665SimpleType.LONG,666SimpleType.LONG,667SimpleType.LONG,668SimpleType.STRING,669SimpleType.LONG,670SimpleType.STRING,671STE_ARRAY_COMPOSITE_TYPE,672SimpleType.BOOLEAN,673SimpleType.BOOLEAN,674};675676static final OpenType[] V6_ITEM_TYPES = {677LOCK_INFO_COMPOSITE_TYPE,678MONITOR_INFO_ARRAY_COMPOSITE_TYPE,679LOCK_INFO_ARRAY_COMPOSITE_TYPE,680};681682static final OpenType[] V9_ITEM_TYPES = {683SimpleType.BOOLEAN,684SimpleType.INTEGER,685};686687static final String[] STE_ITEM_NAMES = {688"classLoaderName",689"moduleName",690"moduleVersion",691"className",692"methodName",693"fileName",694"lineNumber",695"nativeMethod",696};697698static final String[] STE_V5_ITEM_NAMES = Arrays.copyOfRange(STE_ITEM_NAMES, 3, 8);699700static final OpenType[] STE_V5_ITEM_TYPES = {701SimpleType.STRING,702SimpleType.STRING,703SimpleType.STRING,704SimpleType.INTEGER,705SimpleType.BOOLEAN706};707708static final String[] LOCK_INFO_ITEM_NAMES = {709"className",710"identityHashCode",711};712713static final String[] LOCKED_MONITORS_ITEM_NAMES = {714LOCK_INFO_ITEM_NAMES[0],715LOCK_INFO_ITEM_NAMES[1],716"lockedStackFrame",717"lockedStackDepth",718};719720static final Object[] V5_VALUES = {721Long.valueOf(100),722"FooThread",723"RUNNABLE",724Long.valueOf(200),725Long.valueOf(10),726Long.valueOf(300),727Long.valueOf(20),728lockName,729Long.valueOf(99),730"BarThread",731new CompositeData[] { makeStackTraceElement() },732Boolean.valueOf(false),733Boolean.valueOf(false),734};735736static final Object[] V6_VALUES = {737makeLockInfo(),738makeLockedMonitors(),739makeLockedSynchronizers(),740};741742static final Object[] V9_VALUES = {743Boolean.valueOf(true),744Thread.NORM_PRIORITY,745};746747static final String[] ITEM_NAMES =748concat(V5_ITEM_NAMES, V6_ITEM_NAMES, V9_ITEM_NAMES).toArray(String[]::new);749750static final OpenType[] ITEM_TYPES =751concat(V5_ITEM_TYPES, V6_ITEM_TYPES, V9_ITEM_TYPES).toArray(OpenType[]::new);752753static final Object[] VALUES =754concat(V5_VALUES, V6_VALUES, V9_VALUES).toArray(Object[]::new);755756static <T> Stream<T> concat(T[]... streams) {757return Stream.of(streams).flatMap(a -> Arrays.stream(a));758}759}760}761762763