當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。