当前位置: 首页>>代码示例>>Java>>正文


Java State.values方法代码示例

本文整理汇总了Java中java.lang.Thread.State.values方法的典型用法代码示例。如果您正苦于以下问题:Java State.values方法的具体用法?Java State.values怎么用?Java State.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.Thread.State的用法示例。


在下文中一共展示了State.values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculate

import java.lang.Thread.State; //导入方法依赖的package包/类
public void calculate() {
	int max = 0;
	for(State state:State.values()) {
		if(stateCount[state.ordinal()]>max) {
			max = stateCount[state.ordinal()];
			averageState = state;
		}
	}
}
 
开发者ID:denkbar,项目名称:djigger,代码行数:10,代码来源:Aggregate.java

示例2: getAsString

import java.lang.Thread.State; //导入方法依赖的package包/类
@Nonnull
@Nonempty
public String getAsString ()
{
  final StringBuilder aSB = new StringBuilder ();

  // Error always shown first!
  if (StringHelper.hasText (m_sError))
    aSB.append ("ERROR retrieving all thread stack traces: ").append (m_sError).append ("\n\n");

  // Total thread count
  aSB.append ("Total thread count: ").append (m_aList.size ()).append ('\n');

  // Emit thread IDs grouped by state
  final ICommonsMap <State, ICommonsNavigableSet <Long>> aStateMap = _getStateMap ();
  for (final State eState : State.values ())
  {
    final ICommonsSet <Long> aThreadIDs = aStateMap.get (eState);
    final int nSize = aThreadIDs.size ();
    aSB.append ("Thread state ").append (eState).append (" [").append (nSize).append (']');
    if (nSize > 0)
      aSB.append (": ").append (aThreadIDs.toString ());
    aSB.append ('\n');
  }

  // Append all stack traces at the end
  for (final ThreadDescriptor aDescriptor : m_aList)
    aSB.append ('\n').append (aDescriptor.getAsString ());
  return aSB.toString ();
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:31,代码来源:ThreadDescriptorList.java

示例3: getAsMicroNode

import java.lang.Thread.State; //导入方法依赖的package包/类
@Nonnull
public IMicroElement getAsMicroNode ()
{
  final IMicroElement eRet = new MicroElement ("threadlist");
  if (StringHelper.hasText (m_sError))
    eRet.appendElement ("error").appendText (m_sError);

  // Overall thread count
  eRet.setAttribute ("threadcount", m_aList.size ());

  // Emit thread IDs grouped by state
  final ICommonsMap <State, ICommonsNavigableSet <Long>> aStateMap = _getStateMap ();
  for (final State eState : State.values ())
  {
    final ICommonsSet <Long> aThreadIDs = aStateMap.get (eState);
    final int nSize = aThreadIDs.size ();

    final IMicroElement eThreadState = eRet.appendElement ("threadstate");
    eThreadState.setAttribute ("id", eState.toString ());
    eThreadState.setAttribute ("threadcount", nSize);
    if (nSize > 0)
      eThreadState.appendText (StringHelper.getImploded (',', aThreadIDs));
  }

  // Append all stack traces at the end
  for (final ThreadDescriptor aDescriptor : m_aList)
    eRet.appendChild (aDescriptor.getAsMicroNode ());
  return eRet;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:30,代码来源:ThreadDescriptorList.java

示例4: Aggregate

import java.lang.Thread.State; //导入方法依赖的package包/类
public Aggregate() {
	super();
	stateCount = new int[State.values().length];
}
 
开发者ID:denkbar,项目名称:djigger,代码行数:5,代码来源:Aggregate.java


注:本文中的java.lang.Thread.State.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。