當前位置: 首頁>>代碼示例>>Java>>正文


Java State.TERMINATED屬性代碼示例

本文整理匯總了Java中java.lang.Thread.State.TERMINATED屬性的典型用法代碼示例。如果您正苦於以下問題:Java State.TERMINATED屬性的具體用法?Java State.TERMINATED怎麽用?Java State.TERMINATED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.lang.Thread.State的用法示例。


在下文中一共展示了State.TERMINATED屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toThreadState

/** 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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:OverviewController.java

示例2: testGC

@Test
public void testGC() throws Exception {
  CountDownLatch done = new CountDownLatch(1);
  Scheduler scheduler = RxSchedulers.fixedSize(1);
  FinalizeSupport.finalize(scheduler, done::countDown);
  Wrapper<Thread> worker = Wrapper.empty();
  Observable.just(1)
      .subscribeOn(scheduler)
      .doOnNext(i -> worker.set(Thread.currentThread()))
      .blockingSubscribe();
  scheduler = null;
  System.gc();
  assertTrue(done.await(100, TimeUnit.MILLISECONDS));
  assertNotNull(worker.get());
  for (int i = 0; i < 20; i++) {
    System.gc();
    Thread.sleep(5);
    if (worker.get().getState() == State.TERMINATED) {
      return;
    }
  }
  assertEquals(State.TERMINATED, worker.get().getState());
}
 
開發者ID:XDean,項目名稱:Java-EX,代碼行數:23,代碼來源:RxSchedulersTest.java

示例3: start

private void start()
{
    if( _thread == null || _thread.getState() == State.TERMINATED )
    {
        _isTerminated = false;            
        _thread = new Thread( this, _algorithm.name() + "." + _tcx.getTriangulationMode() );
        _thread.start();
        sendEvent( TriangulationProcessEvent.Started );
    }
    else
    {
        // Triangulation already running. Terminate it so we can start a new
        shutdown();
        _restart = true;
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:16,代碼來源:TriangulationProcess.java

示例4: connectionRequest

public String connectionRequest() {
        if (crw == null || crw.getState() == State.TERMINATED) {
            try {
                System.out.println("Connection request START");
                HostsLocal h = Ejb.lookupHostsBean().findByHwidAndSn(hwid, sn);
//            crw = new ConnectionRequestWorker(url, conreqUser, conreqPass);
                crw = new ConnectionRequestWorker(h);
                setLastcrres("In progress");
                crw.start();
            } catch (FinderException ex) {
            	System.out.println("FinderException: " + ex.getLocalizedMessage());
                setLastcrres(ex.getLocalizedMessage());
                Logger.getLogger(HostsBean.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            System.out.println("Connection request no......");
        }
        return null;
    }
 
開發者ID:navisidhu,項目名稱:libreacs,代碼行數:19,代碼來源:HostsBean.java

示例5: trackAllocatedHashinatorBytes

private static synchronized void trackAllocatedHashinatorBytes(long bytes) {
    final long allocated = m_allocatedHashinatorBytes.addAndGet(bytes);
    if (allocated > HASHINATOR_GC_THRESHHOLD) {
        hostLogger.warn(allocated + " bytes of hashinator data has been allocated");
        if (m_emergencyGCThread == null || m_emergencyGCThread.getState() == State.TERMINATED) {
            m_emergencyGCThread = new Thread(new Runnable() {
                @Override
                public void run() {
                    hostLogger.warn("Invoking System.gc() to recoup hashinator bytes");
                    System.gc();
                    try {
                        Thread.sleep(2000);
                    } catch (InterruptedException e) {}
                    hostLogger.info(m_allocatedHashinatorBytes.get() + " bytes of hashinator allocated after GC");
                }
            }, "Hashinator GC thread");
            m_emergencyGCThread.start();
        }
    }
}
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:20,代碼來源:ElasticHashinator.java

示例6: start

private void start()
{
    if( _thread == null || _thread.getState() == State.TERMINATED )
    {
        _isTerminated = false;
        _thread = new Thread( this, _algorithm.name() + "." + _tcx.getTriangulationMode() );
        _thread.start();
        sendEvent( TriangulationProcessEvent.Started );
    }
    else
    {
        // Triangulation already running. Terminate it so we can start a new
        shutdown();
        _restart = true;
    }
}
 
開發者ID:lyrachord,項目名稱:FX3DAndroid,代碼行數:16,代碼來源:TriangulationProcess.java

示例7: startCountDownToExecution

/**
 * Call to start or reset a count down to execution of the current state's
 * command.
 */
private void startCountDownToExecution() {

	try {

		countDownSemaphore.acquire();

		if (countDownThread == null
				|| countDownThread.getState() == State.TERMINATED) {

			countDownThread = new Thread(countDownRunnable);
			countDownThread.start();
		} else {
			timeToExecution = BTN_PRESS_INTERVAL;
		}

	} catch (Exception e) {
		Log.e(TAG, e.toString());
	} finally {
		countDownSemaphore.release();
	}
}
 
開發者ID:mbabic,項目名稱:HeadphoneController,代碼行數:25,代碼來源:HCStateMachine.java

示例8: start

public void start(VideoGridFragment videoGridFragment) {
    if (mLibVlc == null) {
        try {
            mLibVlc = VLCInstance.getLibVlcInstance();
        } catch (LibVlcException e) {
            Log.e(TAG, "Can't obtain libvlc instance");
            e.printStackTrace();
            return;
        }
    }

    isStopping = false;
    if (mThread == null || mThread.getState() == State.TERMINATED) {
        mVideoGridFragment = videoGridFragment;
        mThread = new Thread(this);
        mThread.start();
    }
}
 
開發者ID:smyhvae,項目名稱:VlcTest,代碼行數:18,代碼來源:Thumbnailer.java

示例9: currentThreads

public static List<Thread> currentThreads() {
    List<Thread> threads = Lists.newArrayList();
    for (Thread thread : Thread.getAllStackTraces().keySet()) {
        // DestroyJavaVM is a JVM thread that appears sporadically, easier to just filter it out
        //
        // AWT-AppKit is a JVM thread on OS X that appears during webdriver tests
        //
        // "process reaper" are JVM threads on linux that monitors subprocesses, these use a
        // thread pool in jdk7 and so the threads stay around in the pool even after the
        // subprocess ends, they show up here when mixing local container and javaagent
        // container tests since javaagent container tests create subprocesses and then local
        // container tests check for rogue threads and find these
        if (thread.getState() != State.TERMINATED
                && !thread.getName().equals("DestroyJavaVM")
                && !thread.getName().equals("AWT-AppKit")
                && !thread.getName().equals("process reaper")) {
            threads.add(thread);
        }
    }
    return threads;
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:21,代碼來源:Threads.java

示例10: start

public void start(VideoGridFragment videoGridFragment) {
    if (mLibVlc == null) {
        try {
            mLibVlc = Util.getLibVlcInstance();
        } catch (LibVlcException e) {
            Log.e(TAG, "Can't obtain libvlc instance");
            e.printStackTrace();
            return;
        }
    }

    isStopping = false;
    if (mThread == null || mThread.getState() == State.TERMINATED) {
        mVideoGridFragment = videoGridFragment;
        mThread = new Thread(this);
        mThread.start();
    }
}
 
開發者ID:KlepikovMD,項目名稱:popcorntime-android-kitkat,代碼行數:18,代碼來源:Thumbnailer.java

示例11: connectionRequest

public String connectionRequest() {
        if (crw == null || crw.getState() == State.TERMINATED) {
            try {
                System.out.println("Connection request START");
                HostsLocal h = Ejb.lookupHostsBean().findByHwidAndSn(hwid, sn);
//            crw = new ConnectionRequestWorker(url, conreqUser, conreqPass);
                crw = new ConnectionRequestWorker(h);
                crw.start();
            } catch (FinderException ex) {
                Logger.getLogger(HostsBean.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            System.out.println("Connection request no......");
        }
        return null;
    }
 
開發者ID:ethanpeng,項目名稱:openacs,代碼行數:16,代碼來源:HostsBean.java

示例12: initialize

@Override
protected ConcurrentEnvironment initialize(Thread key, UncaughtExceptionHandler params) {
  if (key.getState() == State.TERMINATED) {
    //send an exception...
    params.uncaughtException(key, new ThreadDeath());
  }
  if (key.isInterrupted()) {
    params.uncaughtException(key, new InterruptedException());
  }
  X_Log.info(ConcurrencyServiceAbstract.class, "Initializing Concurrent Environment", key);
  final ConcurrentEnvironment inited = initializeEnvironment(key, params);
  inited.getThreads().forEach(t->
    environments.put(new AbstractPair<>(t, params), inited)
  );
  return inited;
}
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:16,代碼來源:ConcurrencyServiceAbstract.java

示例13: isSaturated

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;
}
 
開發者ID:bunnyblue,項目名稱:ACDD,代碼行數:30,代碼來源:SaturativeExecutor.java

示例14: isConnected

/**
 * Returns whether the {@link com.hackathon.continuum.ddmlib.AndroidDebugBridge} object is still connected to the adb daemon.
 */
public boolean isConnected() {
    MonitorThread monitorThread = MonitorThread.getInstance();
    if (mDeviceMonitor != null && monitorThread != null) {
        return mDeviceMonitor.isMonitoring() && monitorThread.getState() != State.TERMINATED;
    }
    return false;
}
 
開發者ID:ironmanMA,項目名稱:continuum,代碼行數:10,代碼來源:AndroidDebugBridge.java

示例15: start

private void start() {
  if (_thread == null || _thread.getState() == State.TERMINATED) {
    _isTerminated = false;
    _thread = new Thread(this, _algorithm.name() + "." + _tcx.getTriangulationMode());
    _thread.start();
    sendEvent(TriangulationProcessEvent.Started);
  } else {
    // Triangulation already running. Terminate it so we can start a new
    shutdown();
    _restart = true;
  }
}
 
開發者ID:perunlabs,項目名稱:jsolid,代碼行數:12,代碼來源:TriangulationProcess.java


注:本文中的java.lang.Thread.State.TERMINATED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。