本文整理了Java中java.util.concurrent.ThreadPoolExecutor.toString()
方法的一些代码示例,展示了ThreadPoolExecutor.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPoolExecutor.toString()
方法的具体详情如下:
包路径:java.util.concurrent.ThreadPoolExecutor
类名称:ThreadPoolExecutor
方法名:toString
[英]Returns a string identifying this pool, as well as its state, including indications of run state and estimated worker and task counts.
[中]返回标识此池及其状态的字符串,包括运行状态指示、估计的工作人员和任务计数。
代码示例来源:origin: stagemonitor/stagemonitor
@Override
public String toString() {
return super.toString() + "(thread name = " + threadName + ")";
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public void rejectedExecution(Runnable r,
ThreadPoolExecutor executor) {
// This is not expected to happen.
LOG.error("Could not submit task to executor {}",
executor.toString());
}
});
代码示例来源:origin: robovm/robovm
/**
* Always throws RejectedExecutionException.
*
* @param r the runnable task requested to be executed
* @param e the executor attempting to execute this task
* @throws RejectedExecutionException always
*/
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
throw new RejectedExecutionException("Task " + r.toString() +
" rejected from " +
e.toString());
}
}
代码示例来源:origin: stackoverflow.com
/**
* A handler for rejected tasks that throws a
* {@code RejectedExecutionException}.
*/
public static class AbortPolicy implements RejectedExecutionHandler {
/**
* Creates an {@code AbortPolicy}.
*/
public AbortPolicy() { }
/**
* Always throws RejectedExecutionException.
*
* @param r the runnable task requested to be executed
* @param e the executor attempting to execute this task
* @throws RejectedExecutionException always.
*/
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
throw new RejectedExecutionException("Task " + r.toString() +
" rejected from " +
e.toString());
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
try {
e.getQueue().put(r);
} catch (InterruptedException ignored) { /* should not be interrupted */ }
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
try {
e.getQueue().put(r);
} catch (InterruptedException ignored) { /* should not be interrupted */ }
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
r.run();
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
r.run();
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
BlockingQueue<Runnable> queue = e.getQueue();
int discardSize = queue.size() >> 1;
for (int i = 0; i < discardSize; i++) {
queue.poll();
}
queue.offer(r);
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
BlockingQueue<Runnable> queue = e.getQueue();
int discardSize = queue.size() >> 1;
for (int i = 0; i < discardSize; i++) {
queue.poll();
}
queue.offer(r);
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (r instanceof RejectedRunnable) {
((RejectedRunnable) r).rejected(); // 交给用户来处理
} else {
if (!e.isShutdown()) {
BlockingQueue<Runnable> queue = e.getQueue();
int discardSize = queue.size() >> 1;
for (int i = 0; i < discardSize; i++) {
queue.poll();
}
try {
queue.put(r);
} catch (InterruptedException ignored) { /* should not be interrupted */ }
}
}
}
}
代码示例来源:origin: fengjiachun/Jupiter
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (r instanceof RejectedRunnable) {
((RejectedRunnable) r).rejected(); // 交给用户来处理
} else {
if (!e.isShutdown()) {
BlockingQueue<Runnable> queue = e.getQueue();
int discardSize = queue.size() >> 1;
for (int i = 0; i < discardSize; i++) {
queue.poll();
}
try {
queue.put(r);
} catch (InterruptedException ignored) { /* should not be interrupted */ }
}
}
}
}
代码示例来源:origin: stackoverflow.com
new RejectedExecutionException("Task " + r.toString() + " rejected from " + e.toString()).printStackTrace();
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public final String toString() {
StringBuilder b = new StringBuilder();
b.append(getClass().getSimpleName()).append('[');
b.append("name = ").append(name).append(", ");
if (getQueue() instanceof SizeBlockingQueue) {
@SuppressWarnings("rawtypes")
SizeBlockingQueue queue = (SizeBlockingQueue) getQueue();
b.append("queue capacity = ").append(queue.capacity()).append(", ");
}
appendThreadPoolExecutorDetails(b);
/*
* ThreadPoolExecutor has some nice information in its toString but we
* can't get at it easily without just getting the toString.
*/
b.append(super.toString()).append(']');
return b.toString();
}
代码示例来源:origin: apache/phoenix
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
TaskExecutionMetricsHolder metrics = getRequestMetric(r);
if (metrics != null) {
metrics.getNumRejectedTasks().increment();
}
GLOBAL_REJECTED_TASK_COUNTER.increment();
throw new RejectedExecutionException("Task " + r.toString() + " rejected from " + executor.toString());
}
};
代码示例来源:origin: com.ibm.stocator/stocator
@Override
public void rejectedExecution(Runnable r,
ThreadPoolExecutor executor) {
//This is not expected to happen.
LOG.error("Could not submit task to executor {}", executor.toString());
}
});
代码示例来源:origin: OpenNMS/opennms
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
droppedCounter.inc();
throw new RejectedExecutionException("Task " + r.toString() +
" rejected from " +
e.toString());
}
};
代码示例来源:origin: forezp/BootNettyRpc
@Override
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {
if (threadName != null) {
LOG.error("Thread pool [{}] is exhausted, executor={}", threadName, executor.toString());
}
super.rejectedExecution(runnable, executor);
}
}
代码示例来源:origin: org.jupiter-rpc/jupiter-all
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
logger.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());
dumpJvmInfoIfNeeded();
if (!e.isShutdown()) {
try {
e.getQueue().put(r);
} catch (InterruptedException ignored) { /* should not be interrupted */ }
}
}
}
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
TaskExecutionMetricsHolder metrics = getRequestMetric(r);
if (metrics != null) {
metrics.getNumRejectedTasks().increment();
}
GLOBAL_REJECTED_TASK_COUNTER.increment();
throw new RejectedExecutionException("Task " + r.toString() + " rejected from " + executor.toString());
}
};
内容来源于网络,如有侵权,请联系作者删除!