Java Code Examples for java.lang.Thread.State#NEW
The following examples show how to use
java.lang.Thread.State#NEW .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OverviewController.java From netbeans with Apache License 2.0 | 6 votes |
/** taken from sun.misc.VM * * Returns Thread.State for the given threadStatus */ private static Thread.State toThreadState(int threadStatus) { if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) { return State.RUNNABLE; } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) { return State.BLOCKED; } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) { return State.WAITING; } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) { return State.TIMED_WAITING; } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) { return State.TERMINATED; } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) { return State.NEW; } else { return State.RUNNABLE; } }
Example 2
Source File: OverviewController.java From visualvm with GNU General Public License v2.0 | 6 votes |
/** taken from sun.misc.VM * * Returns Thread.State for the given threadStatus */ private static Thread.State toThreadState(int threadStatus) { if ((threadStatus & JVMTI_THREAD_STATE_RUNNABLE) != 0) { return State.RUNNABLE; } else if ((threadStatus & JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER) != 0) { return State.BLOCKED; } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_INDEFINITELY) != 0) { return State.WAITING; } else if ((threadStatus & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) != 0) { return State.TIMED_WAITING; } else if ((threadStatus & JVMTI_THREAD_STATE_TERMINATED) != 0) { return State.TERMINATED; } else if ((threadStatus & JVMTI_THREAD_STATE_ALIVE) == 0) { return State.NEW; } else { return State.RUNNABLE; } }
Example 3
Source File: AbstractCustomView.java From java-photoslibrary with Apache License 2.0 | 5 votes |
/** Initializes the view in a new thread and shows loading indicator. */ public final void initializeView() { if (initializationThread.getState() == State.NEW) { loadingView.showView(); initializationThread.start(); } }
Example 4
Source File: SaturativeExecutor.java From ACDD with MIT License | 5 votes |
protected boolean isSaturated() { if (getPoolSize() <= 3) { return DEBUG; } int corePoolSize = getCorePoolSize(); int i = CountedTask.mNumRunning.get(); int size = mThreads.size(); if (i < corePoolSize || i < size) { return true; } boolean z; synchronized (mThreads) { Iterator<Thread> it = mThreads.iterator(); size = 0; while (it.hasNext()) { State state = it.next().getState(); if (state == State.RUNNABLE || state == State.NEW) { i = size + 1; } else { if (state == State.TERMINATED) { it.remove(); } i = size; } size = i; } } z = size >= corePoolSize; return z; }
Example 5
Source File: MediaLibrary.java From VCL-Android with Apache License 2.0 | 5 votes |
public boolean isWorking() { if (mLoadingThread != null && mLoadingThread.isAlive() && mLoadingThread.getState() != State.TERMINATED && mLoadingThread.getState() != State.NEW) return true; return false; }