本文整理了Java中java.lang.management.MonitorInfo.getIdentityHashCode()
方法的一些代码示例,展示了MonitorInfo.getIdentityHashCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MonitorInfo.getIdentityHashCode()
方法的具体详情如下:
包路径:java.lang.management.MonitorInfo
类名称:MonitorInfo
方法名:getIdentityHashCode
暂无
代码示例来源:origin: com.h2database/h2
private static String getObjectName(MonitorInfo info) {
return info.getClassName() + "@" +
Integer.toHexString(info.getIdentityHashCode());
}
代码示例来源:origin: gocd/gocd
LinkedHashMap
lockedMonitorJson.put("Class", lockedMonitor.getClassName());
lockedMonitorJson.put("IdentityHashCode", lockedMonitor.getIdentityHashCode());
lockedMonitorJson.put("LockedStackDepth", lockedMonitor.getLockedStackDepth());
lockedMonitorJson.put("StackFrame", lockedMonitor.getLockedStackFrame().toString());
代码示例来源:origin: glowroot/glowroot
.addMonitorInfo(ThreadDump.LockInfo.newBuilder()
.setClassName(lockedMonitor.getClassName())
.setIdentityHashCode(lockedMonitor.getIdentityHashCode()));
代码示例来源:origin: stackoverflow.com
Object lock = ...
ThreadMXBean mx = ManagementFactory.getThreadMXBean();
ThreadInfo[] allInfo = mx.dumpAllThreads(true, false);
for (ThreadInfo threadInfo : allInfo) {
MonitorInfo[] mOnitors= threadInfo.getLockedMonitors();
for (MonitorInfo monitorInfo : monitors) {
if (monitorInfo.getIdentityHashCode() == System.identityHashCode(lock)) {
StackTraceElement[] stackTrace = threadInfo.getStackTrace();
// use the the Information from threadInfo
}
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-core-api
public static boolean isMonitorOwner( Thread thread, Object monitor ) {
if( thread == Thread.currentThread() && Thread.holdsLock( monitor ) ) {
return true;
}
ThreadInfo ti = ManagementFactory.getThreadMXBean().getThreadInfo( new long[]{thread.getId()}, true, false )[0];
for( java.lang.management.MonitorInfo mi : ti.getLockedMonitors() ) {
if( mi.getIdentityHashCode() == System.identityHashCode( monitor ) ) {
return true;
}
}
return false;
}
代码示例来源:origin: com.eventsourcing/h2
private static String getObjectName(MonitorInfo info) {
return info.getClassName() + "@" +
Integer.toHexString(info.getIdentityHashCode());
}
代码示例来源:origin: org.wowtools/h2
private static String getObjectName(MonitorInfo info) {
return info.getClassName() + "@" +
Integer.toHexString(info.getIdentityHashCode());
}
代码示例来源:origin: org.jppf/jppf-common
/**
* Get information on the thread that owns the monitor of the specified object.
* @param object the object for which to lookup an owning thread.
* @return a {@link ThreadInfo} object, or {@code null} if no thread own the object's monitor.
*/
public static ThreadInfo getMonitorOwner(final Object object) {
final ThreadInfo[] allThreads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, false);
final int idHash = System.identityHashCode(object);
for (final ThreadInfo ti: allThreads) {
final MonitorInfo[] mOnitors= ti.getLockedMonitors();
for (final MonitorInfo monitor: monitors) {
if (monitor.getIdentityHashCode() == idHash) return ti;
}
}
return null;
}
代码示例来源:origin: com.caucho/resin
private void jsonDumpMonitors(StringBuilder sb,
MonitorInfo[] lockedMonitors)
{
if (lockedMOnitors== null || lockedMonitors.length == 0)
return;
sb.append(",\n \"monitors\" : [\n");
for (int i = 0; i
if (i != 0)
sb.append(",\n");
sb.append(" {\n");
sb.append(" \"depth\" : " + info.getLockedStackDepth());
sb.append(",\n \"class\" : \"" + info.getClassName() + "\"");
sb.append(",\n \"hash\" : \"" + info.getIdentityHashCode() + "\"");
sb.append(" }");
}
sb.append("\n ]");
}
代码示例来源:origin: baratine/baratine
private void jsonDumpMonitors(StringBuilder sb,
MonitorInfo[] lockedMonitors)
{
if (lockedMOnitors== null || lockedMonitors.length == 0)
return;
sb.append(",\n \"monitors\" : [\n");
for (int i = 0; i
if (i != 0)
sb.append(",\n");
sb.append(" {\n");
sb.append(" \"depth\" : " + info.getLockedStackDepth());
sb.append(",\n \"class\" : \"" + info.getClassName() + "\"");
sb.append(",\n \"hash\" : \"" + info.getIdentityHashCode() + "\"");
sb.append(" }");
}
sb.append("\n ]");
}
代码示例来源:origin: choerodon/choerodon-starters
/**
* Get the thread holding a lock on the given object.
* A null is returned if there is no such thread.
*
* @param object the object to look for a lock on
* @return the thread holding a lock, or
* null if there is none
* @throws NullPointerException
* if the object is null
*/
public static Thread getLockingThread(final Object object) {
if (object == null)
throw new NullPointerException("Null object");
final long identity = System.identityHashCode(object);
final Thread[] allThreads = getAllThreads();
ThreadInfo info = null;
MonitorInfo[] mOnitors= null;
for (Thread thread : allThreads) {
info = getThreadInfo(thread.getId());
if (info == null)
continue;
mOnitors= info.getLockedMonitors();
for (MonitorInfo monitor : monitors)
if (identity == monitor.getIdentityHashCode())
return thread;
}
return null;
}
代码示例来源:origin: io.choerodon/choerodon-starter-hitoa
/**
* Get the thread holding a lock on the given object.
* A null is returned if there is no such thread.
*
* @param object the object to look for a lock on
* @return the thread holding a lock, or
* null if there is none
* @throws NullPointerException
* if the object is null
*/
public static Thread getLockingThread(final Object object) {
if (object == null)
throw new NullPointerException("Null object");
final long identity = System.identityHashCode(object);
final Thread[] allThreads = getAllThreads();
ThreadInfo info = null;
MonitorInfo[] mOnitors= null;
for (Thread thread : allThreads) {
info = getThreadInfo(thread.getId());
if (info == null)
continue;
mOnitors= info.getLockedMonitors();
for (MonitorInfo monitor : monitors)
if (identity == monitor.getIdentityHashCode())
return thread;
}
return null;
}
代码示例来源:origin: david-schuler/javalanche
/**
* Get the thread holding a lock on the given object. A null is returned if
* there is no such thread.
*
* @param object
* the object to look for a lock on
* @return the thread holding a lock, or null if there is none
* @throws NullPointerException
* if the object is null
*/
public static Thread getLockingThread(final Object object) {
if (object == null)
throw new NullPointerException("Null object");
final long identity = System.identityHashCode(object);
final Thread[] allThreads = getAllThreads();
ThreadInfo info = null;
MonitorInfo[] mOnitors= null;
for (Thread thread : allThreads) {
info = getThreadInfo(thread.getId());
if (info == null)
continue;
mOnitors= info.getLockedMonitors();
for (MonitorInfo monitor : monitors)
if (identity == monitor.getIdentityHashCode())
return thread;
}
return null;
}
代码示例来源:origin: com.helger/ph-xml
.append (aMonitorInfo.getClassName ())
.append ('@')
.append (Integer.toHexString (aMonitorInfo.getIdentityHashCode ()))
.append (" at ")
.append (aMonitorInfo.getLockedStackFrame ())
代码示例来源:origin: org.terracotta/terracotta-ee
if (lockedFrame != null && lockedFrame.equals(element)) {
sb.append("\t- locked <0x");
sb.append(Integer.toHexString(monitorInfo.getIdentityHashCode()));
sb.append("> (a ");
sb.append(monitorInfo.getClassName());
代码示例来源:origin: org.terracotta/terracotta-l1-ee
if (lockedFrame != null && lockedFrame.equals(element)) {
sb.append("\t- locked <0x");
sb.append(Integer.toHexString(monitorInfo.getIdentityHashCode()));
sb.append("> (a ");
sb.append(monitorInfo.getClassName());
代码示例来源:origin: org.terracotta/terracotta-l1
if (lockedFrame != null && lockedFrame.equals(element)) {
sb.append("\t- locked <0x");
sb.append(Integer.toHexString(monitorInfo.getIdentityHashCode()));
sb.append("> (a ");
sb.append(monitorInfo.getClassName());
代码示例来源:origin: org.gridgain/gridgain-core
/** Create data transfer object for given monitor info. */
public static VisorThreadMonitorInfo from(MonitorInfo mi) {
assert mi != null;
return new VisorThreadMonitorInfo(mi.getClassName(), mi.getIdentityHashCode(), mi.getLockedStackDepth(),
mi.getLockedStackFrame());
}
代码示例来源:origin: com.helger/ph-xml
eMonitor.setAttribute ("identity", Integer.toHexString (aMonitorInfo.getIdentityHashCode ()));
if (aMonitorInfo.getLockedStackFrame () != null)
eMonitor.setAttribute ("stackframe", aMonitorInfo.getLockedStackFrame ().toString ());