diff --git a/jdk/src/share/classes/java/lang/management/LockInfo.java b/jdk/src/share/classes/java/lang/management/LockInfo.java index b8c2fb5317f..41c135ca5e1 100644 --- a/jdk/src/share/classes/java/lang/management/LockInfo.java +++ b/jdk/src/share/classes/java/lang/management/LockInfo.java @@ -27,7 +27,7 @@ package java.lang.management; import javax.management.openmbean.CompositeData; import java.util.concurrent.locks.*; -import java.beans.ConstructorProperties; +import sun.management.LockInfoCompositeData; /** * Information about a lock. A lock can be a built-in object monitor, @@ -44,8 +44,7 @@ import java.beans.ConstructorProperties; * *
+ *+ * + * @param cd {@code CompositeData} representing a {@code LockInfo} + * + * @throws IllegalArgumentException if {@code cd} does not + * represent a {@code LockInfo} with the attributes described + * above. + * @return a {@code LockInfo} object represented + * by {@code cd} if {@code cd} is not {@code null}; + * {@code null} otherwise. + * + * @since 1.8 + */ + public static LockInfo from(CompositeData cd) { + if (cd == null) { + return null; + } + + if (cd instanceof LockInfoCompositeData) { + return ((LockInfoCompositeData) cd).getLockInfo(); + } else { + return LockInfoCompositeData.toLockInfo(cd); + } + } + /** * Returns a string representation of a lock. The returned * string representation consists of the name of the class of the diff --git a/jdk/src/share/classes/java/lang/management/ThreadInfo.java b/jdk/src/share/classes/java/lang/management/ThreadInfo.java index a68850f6fd8..d64effd69e2 100644 --- a/jdk/src/share/classes/java/lang/management/ThreadInfo.java +++ b/jdk/src/share/classes/java/lang/management/ThreadInfo.java @@ -696,9 +696,7 @@ public class ThreadInfo { *+ *
+ *+ * + *Attribute Name + *Type + *+ * + *className + *java.lang.String + *+ * + *identityHashCode + *java.lang.Integer + *
* If cd does not contain this attribute, * the LockInfo object will be constructed from @@ -766,10 +764,7 @@ public class ThreadInfo { *
* If cd does not contain this attribute, * this attribute will be set to an empty array.