java.lang.management.LockInfo Java Examples
The following examples show how to use
java.lang.management.LockInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThreadDumpUtils.java From pinpoint with Apache License 2.0 | 6 votes |
private static void setLockInfo(ThreadDumpMetricSnapshot threadDump, ThreadInfo threadInfo) { threadDump.setLockName(threadInfo.getLockName()); threadDump.setLockOwnerId(threadInfo.getLockOwnerId()); threadDump.setLockOwnerName(threadInfo.getLockOwnerName()); LockInfo[] lockInfos = threadInfo.getLockedSynchronizers(); if (lockInfos != null) { for (LockInfo lockInfo : lockInfos) { if (lockInfo == null) { continue; } threadDump.addLockedSynchronizer(lockInfo.toString()); } } else { threadDump.setLockedSynchronizers(Collections.<String>emptyList()); } }
Example #2
Source File: ThreadsTableModel.java From MtgDesktopCompanion with GNU General Public License v3.0 | 6 votes |
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 0 : return Long.class; case 1 : return String.class; case 2 : return Double.class; case 3 : return String.class; case 4 : return Integer.class; case 5 : return LockInfo.class; case 6 : return Long.class; case 7 : return Boolean.class; case 8 : return Double.class; default : return Object.class; } }
Example #3
Source File: ThreadInfoCompositeData.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void checkLockInfo(LockInfo li) throws Exception { if (!li.getClassName().equals(lockInfo.getClassName())) { throw new RuntimeException("Class Name = " + li.getClassName() + " expected = " + lockInfo.getClassName()); } if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) { throw new RuntimeException("Class Name = " + li.getIdentityHashCode() + " expected = " + lockInfo.getIdentityHashCode()); } }
Example #4
Source File: LockInfoCompositeData.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static CompositeData toCompositeData(LockInfo li) { if (li == null) { return null; } LockInfoCompositeData licd = new LockInfoCompositeData(li); return licd.getCompositeData(); }
Example #5
Source File: ThreadMonitor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void printLockInfo(LockInfo[] locks) { System.out.println(INDENT + "Locked synchronizers: count = " + locks.length); for (LockInfo li : locks) { System.out.println(INDENT + " - " + li); } System.out.println(); }
Example #6
Source File: LockInfoCompositeData.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static CompositeData toCompositeData(LockInfo li) { if (li == null) { return null; } LockInfoCompositeData licd = new LockInfoCompositeData(li); return licd.getCompositeData(); }
Example #7
Source File: ThreadInfoCompositeData.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void checkLockInfo(LockInfo li) throws Exception { if (!li.getClassName().equals(lockInfo.getClassName())) { throw new RuntimeException("Class Name = " + li.getClassName() + " expected = " + lockInfo.getClassName()); } if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) { throw new RuntimeException("Class Name = " + li.getIdentityHashCode() + " expected = " + lockInfo.getIdentityHashCode()); } }
Example #8
Source File: TimedOutTestsListener.java From big-c with Apache License 2.0 | 5 votes |
private static void printLockInfo(LockInfo[] locks, PrintWriter out) { out.println(INDENT + "Locked synchronizers: count = " + locks.length); for (LockInfo li : locks) { out.println(INDENT + " - " + li); } out.println(); }
Example #9
Source File: LockInfoCompositeData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static LockInfo toLockInfo(CompositeData cd) { if (cd == null) { throw new NullPointerException("Null CompositeData"); } if (!isTypeMatched(lockInfoCompositeType, cd.getCompositeType())) { throw new IllegalArgumentException( "Unexpected composite type for LockInfo"); } String className = getString(cd, CLASS_NAME); int identityHashCode = getInt(cd, IDENTITY_HASH_CODE); return new LockInfo(className, identityHashCode); }
Example #10
Source File: MappedMXBeanType.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
Object toOpenTypeData(Object data) throws OpenDataException { if (data instanceof MemoryUsage) { return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data); } if (data instanceof ThreadInfo) { return ThreadInfoCompositeData.toCompositeData((ThreadInfo) data); } if (data instanceof LockInfo) { if (data instanceof java.lang.management.MonitorInfo) { return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data); } return LockInfoCompositeData.toCompositeData((LockInfo) data); } if (data instanceof MemoryNotificationInfo) { return MemoryNotifInfoCompositeData. toCompositeData((MemoryNotificationInfo) data); } if (data instanceof VMOption) { return VMOptionCompositeData.toCompositeData((VMOption) data); } if (isCompositeData) { // Classes that implement CompositeData // // construct a new CompositeDataSupport object // so that no other classes are sent over the wire CompositeData cd = (CompositeData) data; CompositeType ct = cd.getCompositeType(); String[] itemNames = ct.keySet().toArray(new String[0]); Object[] itemValues = cd.getAll(itemNames); return new CompositeDataSupport(ct, itemNames, itemValues); } throw new OpenDataException(javaClass.getName() + " is not supported for platform MXBeans"); }
Example #11
Source File: PlatformMBeanUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static ModelNode getDetypedLockInfo(final LockInfo lockInfo) { final ModelNode result = new ModelNode(); if (lockInfo != null) { result.get(PlatformMBeanConstants.CLASS_NAME).set(lockInfo.getClassName()); result.get(PlatformMBeanConstants.IDENTITY_HASH_CODE).set(lockInfo.getIdentityHashCode()); } return result; }
Example #12
Source File: ThreadInfoCompositeData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkLockInfo(LockInfo li) throws Exception { if (!li.getClassName().equals(lockInfo.getClassName())) { throw new RuntimeException("Class Name = " + li.getClassName() + " expected = " + lockInfo.getClassName()); } if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) { throw new RuntimeException("Class Name = " + li.getIdentityHashCode() + " expected = " + lockInfo.getIdentityHashCode()); } }
Example #13
Source File: ThreadInfoCompositeData.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public LockInfo[] lockedSynchronizers() { CompositeData[] lockedSyncsData = (CompositeData[]) cdata.get(LOCKED_SYNCS); // The LockedSynchronizers item cannot be null, but if it is we will // get a NullPointerException when we ask for its length. LockInfo[] locks = new LockInfo[lockedSyncsData.length]; for (int i = 0; i < lockedSyncsData.length; i++) { CompositeData cdi = lockedSyncsData[i]; locks[i] = LockInfo.from(cdi); } return locks; }
Example #14
Source File: ThreadDumpUtil.java From pulsar with Apache License 2.0 | 5 votes |
private static void printLockInfo(LockInfo[] locks, PrintWriter out) { out.println(INDENT + "Locked synchronizers: count = " + locks.length); for (LockInfo li : locks) { out.println(INDENT + " - " + li); } out.println(); }
Example #15
Source File: MappedMXBeanType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
Object toOpenTypeData(Object data) throws OpenDataException { if (data instanceof MemoryUsage) { return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data); } if (data instanceof ThreadInfo) { return ThreadInfoCompositeData.toCompositeData((ThreadInfo) data); } if (data instanceof LockInfo) { if (data instanceof java.lang.management.MonitorInfo) { return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data); } return LockInfoCompositeData.toCompositeData((LockInfo) data); } if (data instanceof MemoryNotificationInfo) { return MemoryNotifInfoCompositeData. toCompositeData((MemoryNotificationInfo) data); } if (data instanceof VMOption) { return VMOptionCompositeData.toCompositeData((VMOption) data); } if (isCompositeData) { // Classes that implement CompositeData // // construct a new CompositeDataSupport object // so that no other classes are sent over the wire CompositeData cd = (CompositeData) data; CompositeType ct = cd.getCompositeType(); String[] itemNames = ct.keySet().toArray(new String[0]); Object[] itemValues = cd.getAll(itemNames); return new CompositeDataSupport(ct, itemNames, itemValues); } throw new OpenDataException(javaClass.getName() + " is not supported for platform MXBeans"); }
Example #16
Source File: TimedOutTestsListener.java From hadoop-ozone with Apache License 2.0 | 5 votes |
private static void printLockInfo(LockInfo[] locks, PrintWriter out) { out.println(INDENT + "Locked synchronizers: count = " + locks.length); for (LockInfo li : locks) { out.println(INDENT + " - " + li); } out.println(); }
Example #17
Source File: TimedOutTestsListener.java From distributedlog with Apache License 2.0 | 5 votes |
private static void printLockInfo(LockInfo[] locks, PrintWriter out) { out.println(indent + "Locked synchronizers: count = " + locks.length); for (LockInfo li : locks) { out.println(indent + " - " + li); } out.println(); }
Example #18
Source File: LockInfoCompositeData.java From hottub with GNU General Public License v2.0 | 5 votes |
public static CompositeData toCompositeData(LockInfo li) { if (li == null) { return null; } LockInfoCompositeData licd = new LockInfoCompositeData(li); return licd.getCompositeData(); }
Example #19
Source File: LockInfoCompositeData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static LockInfo toLockInfo(CompositeData cd) { if (cd == null) { throw new NullPointerException("Null CompositeData"); } if (!isTypeMatched(lockInfoCompositeType, cd.getCompositeType())) { throw new IllegalArgumentException( "Unexpected composite type for LockInfo"); } String className = getString(cd, CLASS_NAME); int identityHashCode = getInt(cd, IDENTITY_HASH_CODE); return new LockInfo(className, identityHashCode); }
Example #20
Source File: MappedMXBeanType.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
Object toOpenTypeData(Object data) throws OpenDataException { if (data instanceof MemoryUsage) { return MemoryUsageCompositeData.toCompositeData((MemoryUsage) data); } if (data instanceof ThreadInfo) { return ThreadInfoCompositeData.toCompositeData((ThreadInfo) data); } if (data instanceof LockInfo) { if (data instanceof java.lang.management.MonitorInfo) { return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data); } return LockInfoCompositeData.toCompositeData((LockInfo) data); } if (data instanceof MemoryNotificationInfo) { return MemoryNotifInfoCompositeData. toCompositeData((MemoryNotificationInfo) data); } if (data instanceof VMOption) { return VMOptionCompositeData.toCompositeData((VMOption) data); } if (isCompositeData) { // Classes that implement CompositeData // // construct a new CompositeDataSupport object // so that no other classes are sent over the wire CompositeData cd = (CompositeData) data; CompositeType ct = cd.getCompositeType(); String[] itemNames = ct.keySet().toArray(new String[0]); Object[] itemValues = cd.getAll(itemNames); return new CompositeDataSupport(ct, itemNames, itemValues); } throw new OpenDataException(javaClass.getName() + " is not supported for platform MXBeans"); }
Example #21
Source File: ThreadInfoCompositeData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public LockInfo[] lockedSynchronizers() { CompositeData[] lockedSyncsData = (CompositeData[]) cdata.get(LOCKED_SYNCS); // The LockedSynchronizers item cannot be null, but if it is we will // get a NullPointerException when we ask for its length. LockInfo[] locks = new LockInfo[lockedSyncsData.length]; for (int i = 0; i < lockedSyncsData.length; i++) { CompositeData cdi = lockedSyncsData[i]; locks[i] = LockInfo.from(cdi); } return locks; }
Example #22
Source File: LockInfoCompositeData.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static LockInfo toLockInfo(CompositeData cd) { if (cd == null) { throw new NullPointerException("Null CompositeData"); } if (!isTypeMatched(lockInfoCompositeType, cd.getCompositeType())) { throw new IllegalArgumentException( "Unexpected composite type for LockInfo"); } String className = getString(cd, CLASS_NAME); int identityHashCode = getInt(cd, IDENTITY_HASH_CODE); return new LockInfo(className, identityHashCode); }
Example #23
Source File: DeadlockDetector.java From mapleLemon with GNU General Public License v2.0 | 5 votes |
@Override public void run() { boolean noDeadLocks = true; while (noDeadLocks) { try { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); long[] threadIds = bean.findDeadlockedThreads(); if (threadIds != null) { log.error("检测到死锁!!"); this.sb = new StringBuilder(); noDeadLocks = false; ThreadInfo[] infos = bean.getThreadInfo(threadIds); this.sb.append("\n线程锁信息: \n"); for (ThreadInfo threadInfo : infos) { printThreadInfo(threadInfo); LockInfo[] lockInfos = threadInfo.getLockedSynchronizers(); MonitorInfo[] monitorInfos = threadInfo.getLockedMonitors(); printLockInfo(lockInfos); printMonitorInfo(threadInfo, monitorInfos); } this.sb.append("\n线程转储: \n"); for (ThreadInfo ti : bean.dumpAllThreads(true, true)) { printThreadInfo(ti); } log.error(this.sb.toString()); } Thread.sleep(this.checkInterval); } catch (Exception ex) { ex.printStackTrace(); } } }
Example #24
Source File: ThreadInfoCompositeData.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void checkLockInfo(LockInfo li) throws Exception { if (!li.getClassName().equals(lockInfo.getClassName())) { throw new RuntimeException("Class Name = " + li.getClassName() + " expected = " + lockInfo.getClassName()); } if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) { throw new RuntimeException("Class Name = " + li.getIdentityHashCode() + " expected = " + lockInfo.getIdentityHashCode()); } }
Example #25
Source File: ThreadInfoCompositeData.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkLockInfo(LockInfo li) throws Exception { if (!li.getClassName().equals(lockInfo.getClassName())) { throw new RuntimeException("Class Name = " + li.getClassName() + " expected = " + lockInfo.getClassName()); } if (li.getIdentityHashCode() != lockInfo.getIdentityHashCode()) { throw new RuntimeException("Class Name = " + li.getIdentityHashCode() + " expected = " + lockInfo.getIdentityHashCode()); } }
Example #26
Source File: CurrentRequestsHandler.java From styx with Apache License 2.0 | 5 votes |
private String getThreadState(ThreadInfo t) { StringBuilder sb = new StringBuilder(); LockInfo lock = t.getLockInfo(); if (lock != null && t.getThreadState() != BLOCKED) { sb.append(format("%n - waiting on <0x%08x> (a %s)", lock.getIdentityHashCode(), lock.getClassName())); sb.append(format("%n - locked <0x%08x> (a %s)", lock.getIdentityHashCode(), lock.getClassName())); } else if (lock != null && t.getThreadState() == BLOCKED) { sb.append(format("%n - waiting to lock <0x%08x> (a %s)", lock.getIdentityHashCode(), lock.getClassName())); } return sb.toString(); }
Example #27
Source File: CurrentRequestsHandler.java From styx with Apache License 2.0 | 5 votes |
private String getThreadLockedSynchronizer(ThreadInfo t) { StringBuilder sb = new StringBuilder(); LockInfo[] locks = t.getLockedSynchronizers(); if (locks.length > 0) { sb.append(format(" Locked synchronizers: count = %d%n", locks.length)); for (LockInfo l : locks) { sb.append(format(" - %s%n", l)); } sb.append("\n"); } return sb.toString(); }
Example #28
Source File: LockInfoCompositeData.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static CompositeData toCompositeData(LockInfo li) { if (li == null) { return null; } LockInfoCompositeData licd = new LockInfoCompositeData(li); return licd.getCompositeData(); }
Example #29
Source File: ThreadMonitor.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Prints the thread dump information with locks info to System.out. */ private void dumpThreadInfoWithLocks() { System.out.println("Full Java thread dump with locks info"); ThreadInfo[] tinfos = tmbean.dumpAllThreads(true, true); for (ThreadInfo ti : tinfos) { printThreadInfo(ti); LockInfo[] syncs = ti.getLockedSynchronizers(); printLockInfo(syncs); } System.out.println(); }
Example #30
Source File: ThreadInfoCompositeData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public LockInfo[] lockedSynchronizers() { CompositeData[] lockedSyncsData = (CompositeData[]) cdata.get(LOCKED_SYNCS); // The LockedSynchronizers item cannot be null, but if it is we will // get a NullPointerException when we ask for its length. LockInfo[] locks = new LockInfo[lockedSyncsData.length]; for (int i = 0; i < lockedSyncsData.length; i++) { CompositeData cdi = lockedSyncsData[i]; locks[i] = LockInfo.from(cdi); } return locks; }