本文整理汇总了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;
}
}
}
示例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 ();
}
示例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;
}
示例4: Aggregate
import java.lang.Thread.State; //导入方法依赖的package包/类
public Aggregate() {
super();
stateCount = new int[State.values().length];
}