本文整理了Java中java.util.concurrent.ScheduledThreadPoolExecutor.prestartCoreThread()
方法的一些代码示例,展示了ScheduledThreadPoolExecutor.prestartCoreThread()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledThreadPoolExecutor.prestartCoreThread()
方法的具体详情如下:
包路径:java.util.concurrent.ScheduledThreadPoolExecutor
类名称:ScheduledThreadPoolExecutor
方法名:prestartCoreThread
暂无
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Requeues a periodic task unless current run state precludes it.
* Same idea as delayedExecute except drops task rather than rejecting.
*
* @param task the task
*/
void reExecutePeriodic(RunnableScheduledFuture<?> task) {
if (canRunInCurrentRunState(true)) {
super.getQueue().add(task);
if (!canRunInCurrentRunState(true) && remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* Requeues a periodic task unless current run state precludes it.
* Same idea as delayedExecute except drops task rather than rejecting.
*
* @param task the task
*/
void reExecutePeriodic(RunnableScheduledFuture<?> task) {
if (canRunInCurrentRunState(true)) {
super.getQueue().add(task);
if (!canRunInCurrentRunState(true) && remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: com.github.mcpat.libxjava/libxjava-jse5
public ScheduledTaskExecutor(int initialPoolSize, int maxPoolSize, long keepAliveTimeInMillis, IThreadFactory threadFactory) {
_executorImpl= new ScheduledThreadPoolExecutorExtender(maxPoolSize, threadFactory);
_executorImpl.setKeepAliveTime(keepAliveTimeInMillis, TimeUnit.MILLISECONDS);
_executorImpl.allowCoreThreadTimeOut(true);
for(int i= 0; i < initialPoolSize; i++) {
_executorImpl.prestartCoreThread();
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Requeues a periodic task unless current run state precludes it.
* Same idea as delayedExecute except drops task rather than rejecting.
*
* @param task the task
*/
void reExecutePeriodic(RunnableScheduledFuture<?> task) {
if (canRunInCurrentRunState(true)) {
super.getQueue().add(task);
if (!canRunInCurrentRunState(true) && remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Main execution method for delayed or periodic tasks. If pool
* is shut down, rejects the task. Otherwise adds task to queue
* and starts a thread, if necessary, to run it. (We cannot
* prestart the thread to run the task because the task (probably)
* shouldn't be run yet,) If the pool is shut down while the task
* is being added, cancel and remove it if required by state and
* run-after-shutdown parameters.
*
* @param task the task
*/
private void delayedExecute(RunnableScheduledFuture<?> task) {
if (isShutdown())
reject(task);
else {
super.getQueue().add(task);
if (isShutdown() &&
!canRunInCurrentRunState(task.isPeriodic()) &&
remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* Main execution method for delayed or periodic tasks. If pool
* is shut down, rejects the task. Otherwise adds task to queue
* and starts a thread, if necessary, to run it. (We cannot
* prestart the thread to run the task because the task (probably)
* shouldn't be run yet,) If the pool is shut down while the task
* is being added, cancel and remove it if required by state and
* run-after-shutdown parameters.
*
* @param task the task
*/
private void delayedExecute(RunnableScheduledFuture<?> task) {
if (isShutdown())
reject(task);
else {
super.getQueue().add(task);
if (isShutdown() &&
!canRunInCurrentRunState(task.isPeriodic()) &&
remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* Main execution method for delayed or periodic tasks. If pool
* is shut down, rejects the task. Otherwise adds task to queue
* and starts a thread, if necessary, to run it. (We cannot
* prestart the thread to run the task because the task (probably)
* shouldn't be run yet,) If the pool is shut down while the task
* is being added, cancel and remove it if required by state and
* run-after-shutdown parameters.
*
* @param task the task
*/
private void delayedExecute(RunnableScheduledFuture<?> task) {
if (isShutdown())
reject(task);
else {
super.getQueue().add(task);
if (isShutdown() &&
!canRunInCurrentRunState(task.isPeriodic()) &&
remove(task))
task.cancel(false);
else
prestartCoreThread();
}
}
代码示例来源:origin: threadly/threadly
@Test
public void idleScheduledThreadPoolExecutorTest() {
ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1);
profilingExecutor(stpe);
stpe.prestartCoreThread();
profiler.start();
blockForProfilerSample();
verifyDumpContains("ScheduledThreadPoolExecutor idle thread");
}
}
内容来源于网络,如有侵权,请联系作者删除!