当前位置: 首页>>代码示例>>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;未经允许,请勿转载。