1 7 8 package java.lang.management; 9 10 import javax.management.openmbean.CompositeData ; 11 import java.util.concurrent.locks.*; 12 import java.beans.ConstructorProperties ; 13 14 39 40 public class LockInfo { 41 42 private String className; 43 private int identityHashCode; 44 45 52 @ConstructorProperties ({"className", "identityHashCode"}) 53 public LockInfo(String className, int identityHashCode) { 54 if (className == null) { 55 throw new NullPointerException ("Parameter className cannot be null"); 56 } 57 this.className = className; 58 this.identityHashCode = identityHashCode; 59 } 60 61 64 LockInfo(Object lock) { 65 this.className = lock.getClass().getName(); 66 this.identityHashCode = System.identityHashCode(lock); 67 } 68 69 74 public String getClassName() { 75 return className; 76 } 77 78 84 public int getIdentityHashCode() { 85 return identityHashCode; 86 } 87 88 102 public String toString() { 103 return className + '@' + Integer.toHexString(identityHashCode); 104 } 105 } 106 | Popular Tags |