Java Code Examples for java.lang.management.LockInfo
The following examples show how to use
java.lang.management.LockInfo. These examples are extracted from open source projects.
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 Project: pinpoint Source File: ThreadDumpUtils.java License: 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 Project: MtgDesktopCompanion Source File: ThreadsTableModel.java License: 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 Project: hadoop-ozone Source File: TimedOutTestsListener.java License: 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 4
Source Project: dragonwell8_jdk Source File: ThreadMonitor.java License: 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 5
Source Project: dragonwell8_jdk Source File: ThreadMonitor.java License: 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 Project: dragonwell8_jdk Source File: LockInfoCompositeData.java License: 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 Project: dragonwell8_jdk Source File: LockInfoCompositeData.java License: 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 8
Source Project: dragonwell8_jdk Source File: MappedMXBeanType.java License: 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 9
Source Project: openjdk-jdk9 Source File: ThreadInfoCompositeData.java License: 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 10
Source Project: gemfirexd-oss Source File: CF6Impl.java License: Apache License 2.0 | 5 votes |
@Override public LI[] getLockedSynchronizers(ThreadInfo info) { LockInfo[] monitors = info.getLockedSynchronizers(); if(monitors == null) { return null; } LI[] results = new LI[monitors.length]; for(int i = 0; i < monitors.length; i++) { results[i] = new LI(monitors[i].getClassName(), monitors[i].getIdentityHashCode()); } return results; }
Example 11
Source Project: metrics Source File: ThreadDumpTest.java License: Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { final StackTraceElement rLine1 = new StackTraceElement("Blah", "blee", "Blah.java", 100); when(runnable.getThreadName()).thenReturn("runnable"); when(runnable.getThreadId()).thenReturn(100L); when(runnable.getThreadState()).thenReturn(Thread.State.RUNNABLE); when(runnable.getStackTrace()).thenReturn(new StackTraceElement[]{ rLine1 }); when(runnable.getLockedMonitors()).thenReturn(new MonitorInfo[]{ }); when(runnable.getLockedSynchronizers()).thenReturn(new LockInfo[]{ }); when(threadMXBean.dumpAllThreads(true, true)).thenReturn(new ThreadInfo[]{ runnable }); }
Example 12
Source Project: tda Source File: MBeanDumper.java License: GNU Lesser General Public License v2.1 | 5 votes |
private void printLockInfo(LockInfo[] locks, StringBuilder dump) { dump.append(INDENT + "Locked synchronizers: count = " + locks.length); dump.append("\n"); for (int i = 0; i < locks.length; i++) { LockInfo li = locks[i]; dump.append(INDENT + " - " + li); dump.append("\n"); } dump.append("\n"); }
Example 13
Source Project: jdk8u-dev-jdk Source File: ThreadMonitor.java License: 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 14
Source Project: jdk8u-jdk Source File: LockInfoCompositeData.java License: 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 15
Source Project: TencentKona-8 Source File: LockInfoCompositeData.java License: 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 16
Source Project: tda Source File: MBeanDumper.java License: GNU Lesser General Public License v2.1 | 5 votes |
/** * Prints the thread dump information with locks info to System.out. */ private void dumpThreadInfoWithLocks(StringBuilder dump) { dump.append(getDumpDate()); dump.append(dumpPrefix); dump.append("\n"); ThreadInfo[] tinfos = tmbean.dumpAllThreads(true, true); for (int i = 0; i < tinfos.length; i++) { ThreadInfo ti = tinfos[i]; printThreadInfo(ti, dump); LockInfo[] syncs = ti.getLockedSynchronizers(); printLockInfo(syncs, dump); } dump.append("\n"); }
Example 17
Source Project: gemfirexd-oss Source File: CF6Impl.java License: Apache License 2.0 | 5 votes |
@Override public LI getLockInfo(ThreadInfo threadInfo) { LockInfo lockInfo= threadInfo.getLockInfo(); if(lockInfo == null) { return null; } return new LI(lockInfo.getClassName(), lockInfo.getIdentityHashCode()); }
Example 18
Source Project: TencentKona-8 Source File: ThreadInfoCompositeData.java License: 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 19
Source Project: TencentKona-8 Source File: ThreadInfoCompositeData.java License: 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 20
Source Project: jdk8u_jdk Source File: LockInfoCompositeData.java License: 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 21
Source Project: openjdk-8-source Source File: LockInfoCompositeData.java License: 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 22
Source Project: openjdk-jdk9 Source File: ThreadInfoCompositeData.java License: 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 23
Source Project: big-c Source File: TimedOutTestsListener.java License: 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 24
Source Project: jdk8u-dev-jdk Source File: LockInfoCompositeData.java License: 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 25
Source Project: jdk8u60 Source File: MappedMXBeanType.java License: 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 26
Source Project: wildfly-core Source File: PlatformMBeanUtil.java License: 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 27
Source Project: jdk8u-jdk Source File: ThreadInfoCompositeData.java License: 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 28
Source Project: jdk8u60 Source File: ThreadInfoCompositeData.java License: 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 29
Source Project: pulsar Source File: ThreadDumpUtil.java License: 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 30
Source Project: openjdk-jdk8u Source File: MappedMXBeanType.java License: 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"); }