本文整理了Java中org.jboss.threads.QueuelessExecutor
类的一些代码示例,展示了QueuelessExecutor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueuelessExecutor
类的具体详情如下:
包路径:org.jboss.threads.QueuelessExecutor
类名称:QueuelessExecutor
[英]A queueless thread pool. If one or more threads are waiting for work when a task is submitted, it will be used. Otherwise, if fewer than the maximum threads are started, a new thread is created.
[中]无队列线程池。如果提交任务时一个或多个线程正在等待工作,则将使用该任务。否则,如果启动的线程少于最大线程数,则会创建一个新线程。
代码示例来源:origin: wildfly/wildfly
final long deadline = now + unit.toMillis(timeout);
if (deadline < 0L) {
executeBlocking(task);
return;
代码示例来源:origin: wildfly/wildfly
public List<Runnable> shutdownNow() {
shutdown();
// tasks are never queued
return Collections.emptyList();
}
代码示例来源:origin: wildfly/wildfly
public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
final Lock lock = this.lock;
lock.lock();
try {
if (! stop) {
throw Messages.msg.notShutDown();
}
final Date deadline = new Date(clipHigh(unit.toMillis(timeout) + System.currentTimeMillis()));
final Condition threadDeath = this.threadDeath;
while (! runningThreads.isEmpty() && threadDeath.awaitUntil(deadline));
return runningThreads.isEmpty();
} finally {
lock.unlock();
}
}
代码示例来源:origin: wildfly/wildfly-core
public synchronized void start(final StartContext context) throws StartException {
final TimeSpec keepAliveSpec = keepAlive;
long keepAlive = keepAliveSpec == null ? Long.MAX_VALUE : keepAliveSpec.getUnit().toMillis(keepAliveSpec.getDuration());
final QueuelessExecutor queuelessExecutor = new QueuelessExecutor(threadFactoryValue.getValue(), JBossExecutors.directExecutor(), handoffExecutorValue.getOptionalValue(), keepAlive);
queuelessExecutor.setMaxThreads(maxThreads);
queuelessExecutor.setBlocking(blocking);
executor = new ManagedQueuelessExecutorService(queuelessExecutor);
}
代码示例来源:origin: org.jboss.threads/jboss-threads-metadata
public static QueuelessExecutor createQueuelessExecutor(final ThreadFactory threadFactory, final List<Object> taskFilterObjects, final Executor handoffExecutor, final long idleTimeout) {
return new QueuelessExecutor(threadFactory, createTaskFilter(taskFilterObjects), handoffExecutor, idleTimeout);
}
代码示例来源:origin: wildfly/wildfly-core
@Override
public void executeNonBlocking(Runnable task)
throws RejectedExecutionException {
executor.executeNonBlocking(task);
}
}
代码示例来源:origin: wildfly/wildfly-core
public int getCurrentThreadCount() {
return executor.getCurrentThreadCount();
}
代码示例来源:origin: wildfly/wildfly-core
<A> void addShutdownListener(final EventListener<A> shutdownListener, final A attachment) {
executor.addShutdownListener(shutdownListener, attachment);
}
代码示例来源:origin: wildfly/wildfly-core
@Override
public void executeBlocking(Runnable task)
throws RejectedExecutionException, InterruptedException {
executor.executeBlocking(task);
}
代码示例来源:origin: wildfly/wildfly-core
@Override
void internalShutdown() {
executor.shutdown();
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
final Lock lock = this.lock;
lock.lock();
try {
if (! stop) {
throw Messages.msg.notShutDown();
}
final Date deadline = new Date(clipHigh(unit.toMillis(timeout) + System.currentTimeMillis()));
final Condition threadDeath = this.threadDeath;
while (! runningThreads.isEmpty() && threadDeath.awaitUntil(deadline));
return runningThreads.isEmpty();
} finally {
lock.unlock();
}
}
代码示例来源:origin: wildfly/wildfly-core
@Override
public void executeBlocking(Runnable task, long timeout, TimeUnit unit)
throws RejectedExecutionException, InterruptedException {
executor.executeBlocking(task, timeout, unit);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public List<Runnable> shutdownNow() {
shutdown();
// tasks are never queued
return Collections.emptyList();
}
代码示例来源:origin: org.jboss.threads/jboss-threads
public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
final Lock lock = this.lock;
lock.lock();
try {
if (! stop) {
throw Messages.msg.notShutDown();
}
final Date deadline = new Date(clipHigh(unit.toMillis(timeout) + System.currentTimeMillis()));
final Condition threadDeath = this.threadDeath;
while (! runningThreads.isEmpty() && threadDeath.awaitUntil(deadline));
return runningThreads.isEmpty();
} finally {
lock.unlock();
}
}
代码示例来源:origin: org.jboss.threads/jboss-threads
final long deadline = now + unit.toMillis(timeout);
if (deadline < 0L) {
executeBlocking(task);
return;
代码示例来源:origin: org.jboss.threads/jboss-threads
public List<Runnable> shutdownNow() {
shutdown();
// tasks are never queued
return Collections.emptyList();
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
final long deadline = now + unit.toMillis(timeout);
if (deadline < 0L) {
executeBlocking(task);
return;
内容来源于网络,如有侵权,请联系作者删除!