Java LockInfo类代码示例

本文整理汇总了Java中java.lang.management.LockInfo的典型用法代码示例。如果您正苦于以下问题:Java LockInfo类的具体用法?Java LockInfo怎么用?Java LockInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java LockInfo类代码示例

LockInfo类属于java.lang.management包,在下文中一共展示了LockInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: threadLockedSynchronizers

import java.lang.management.LockInfo; //导入依赖的package包/类
private static String threadLockedSynchronizers(ThreadInfo threadInfo) {
  final String NO_SYNCH_INFO = "no locked synchronizers information available\n";
  if (null == threadInfo) { return NO_SYNCH_INFO; }
  try {
    final LockInfo[] lockInfos = threadInfo.getLockedSynchronizers();
    if (lockInfos.length > 0) {
      final StringBuffer lockedSynchBuff = new StringBuffer();
      lockedSynchBuff.append("\nLocked Synchronizers: \n");
      for (final LockInfo lockInfo : lockInfos) {
        lockedSynchBuff.append(lockInfo.getClassName()).append(" <").append(lockInfo.getIdentityHashCode())
            .append("> \n");
      }
      return lockedSynchBuff.append("\n").toString();
    } else {
      return "";
    }
  } catch (final Exception e) {
    return NO_SYNCH_INFO;
  }
} 
开发者ID:Terracotta-OSS,项目名称:terracotta-platform,代码行数:21,代码来源:DiagnosticUtility.java

示例2: initData

import java.lang.management.LockInfo; //导入依赖的package包/类
private void initData(Properties props) {
    this.db = new HashMap<String, Map<String, CRDTData<?>>>();
    this.locks = new HashMap<CRDTIdentifier, LockInfo>();
    // this.notifications = new LinkedList<NotificationRecord>();
    this.modified = new HashSet<CRDTData<?>>();

    this.version = ClockFactory.newClock();
    this.cltClock = ClockFactory.newClock();

    initDB(props);

    if (dbServer.ramOnly()) {

        CRDTIdentifier id = new CRDTIdentifier("e", "1");
        ManagedCRDT<IntegerCRDT> i = new ManagedCRDT<IntegerCRDT>(id, new IntegerCRDT(id), version.clone(), true);
        localPutCRDT(i);

        CRDTIdentifier id2 = new CRDTIdentifier("e", "2");
        ManagedCRDT<IntegerCRDT> i2 = new ManagedCRDT<IntegerCRDT>(id2, new IntegerCRDT(id2), version.clone(), true);
        localPutCRDT(i2);
    }
} 
开发者ID:SyncFree,项目名称:SwiftCloud,代码行数:23,代码来源:DCDataServer.java

示例3: setLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
private static void setLockInfo(TThreadDump 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.addToLockedSynchronizers(lockInfo.toString());
        }
    } else {
        threadDump.setLockedSynchronizers(Collections.<String>emptyList());
    }
} 
开发者ID:naver,项目名称:pinpoint,代码行数:19,代码来源:ThreadDumpUtils.java

示例4: extractRuntime

import java.lang.management.LockInfo; //导入依赖的package包/类
private @Nonnull JmxRuntime extractRuntime(@Nonnull MBeanServerConnection connection) {
    final List<ThreadInfo> threads = getRemoteThreads(connection);
    HashSet<JmxThread.Builder> builders = new HashSet<JmxThread.Builder>(threads.size());

    for (ThreadInfo thread: threads) {
        JmxThread.Builder builder = new JmxThread.Builder();
        final ThreadStatus status = fillThreadInfoData(thread, builder);

        final LockInfo lockInfo = thread.getLockInfo();
        if (lockInfo != null) {
            builder.setWaitingToLock(getSynchronizer(lockInfo));
        }

        builders.add(builder);
    }

    return new JmxRuntime(builders, new Date(), getVmName(connection));
} 
开发者ID:olivergondza,项目名称:dumpling,代码行数:19,代码来源:JmxRuntimeFactory.java

示例5: outputWaitingInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
@Override
void outputWaitingInfo(ThreadInfo info, ExtraLockInfo exLockInfo, StringBuffer buffer) {
    final LockInfo lock_info = info.getLockInfo();
    if (lock_info != null)
    {
        formatLock(lock_info, "waiting on", buffer);
        if (exLockInfo != null)
        {
            if (exLockInfo.isWaitingFor(ExtraLockInfo.WaitingFor.WRITE, lock_info))
                buffer.append(" for write");
            if (exLockInfo.isWaitingFor(ExtraLockInfo.WaitingFor.READ, lock_info))
                buffer.append(" for read");
        }
        buffer.append(".");
        long lock_owner = info.getLockOwnerId();
        if (lock_owner!=-1)
        {
            buffer.append(" Locked by \"");
            buffer.append(info.getLockOwnerName());
            buffer.append("\" tid=");
            buffer.append(lock_owner);
        }
        buffer.append("\n");
    }
} 
开发者ID:workplacesystems,项目名称:utilsj,代码行数:26,代码来源:ThreadDumperJdk16.java

示例6: printLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
private static void printLockInfo(LockInfo[] locks, StringBuilder sb) {
    sb.append("\tLocked synchronizers: count = " + locks.length).append("\n");
    for (LockInfo li : locks) {
        sb.append("\t  - " + li).append("\n");
    }
    sb.append("\n");
} 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NbTestCase.java

示例7: printLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
private void printLockInfo(LockInfo[] locks, PrintStream out) {
   out.println(INDENT + "Locked synchronizers: count = " + locks.length); // NOI18N
   for (LockInfo li : locks) {
       out.println(INDENT + "  - " + li); // NOI18N
   }
   out.println();
} 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:Detector.java

示例8: printLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
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();
} 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:TimedOutTestsListener.java

示例9: dumpThreadInfoWithLocks

import java.lang.management.LockInfo; //导入依赖的package包/类
/**
 * 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();
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ThreadMonitor.java

示例10: printLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
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();
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ThreadMonitor.java

示例11: toCompositeData

import java.lang.management.LockInfo; //导入依赖的package包/类
public static CompositeData toCompositeData(LockInfo li) {
    if (li == null) {
        return null;
    }

    LockInfoCompositeData licd = new LockInfoCompositeData(li);
    return licd.getCompositeData();
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:LockInfoCompositeData.java

示例12: toLockInfo

import java.lang.management.LockInfo; //导入依赖的package包/类
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);
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:LockInfoCompositeData.java

示例13: toOpenTypeData

import java.lang.management.LockInfo; //导入依赖的package包/类
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");
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:MappedMXBeanType.java

示例14: lockedSynchronizers

import java.lang.management.LockInfo; //导入依赖的package包/类
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;
} 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ThreadInfoCompositeData.java

示例15: generateThreadStack

import java.lang.management.LockInfo; //导入依赖的package包/类
private String generateThreadStack(ThreadInfo info) {
  // This is annoying, but the to string method on info sucks.
  StringBuilder result = new StringBuilder();
  result.append(info.getThreadName()).append(" ID=0x")
      .append(Long.toHexString(info.getThreadId())).append("(").append(info.getThreadId())
      .append(") state=").append(info.getThreadState());


  if (info.getLockInfo() != null) {
    result.append("\n\twaiting to lock <" + info.getLockInfo() + ">");
  }
  for (StackTraceElement element : info.getStackTrace()) {
    result.append("\n\tat " + element);
    for (MonitorInfo monitor : info.getLockedMonitors()) {
      if (element.equals(monitor.getLockedStackFrame())) {
        result.append("\n\tlocked <" + monitor + ">");
      }
    }
  }

  if (info.getLockedSynchronizers().length > 0) {
    result.append("\nLocked synchronizers:");
    for (LockInfo sync : info.getLockedSynchronizers()) {
      result.append(
          "\n" + sync.getClassName() + "@" + Integer.toHexString(sync.getIdentityHashCode()));

    }
  }

  return result.toString();
} 
开发者ID:ampool,项目名称:monarch,代码行数:32,代码来源:LocalThread.java

本文标签属性:

示例:示例英语

代码:代码是什么

java:java面试题

LockInfo:LockInfo

上一篇:C++ deadline_timer::cancel方法代码示例
下一篇:现实主义是什么意思(现实主义是什么意思)(什么是现实主义)

为您推荐