final class ThreadPool extends Object implements Executor, java.util.concurrent.Executor
This implementation uses the Logger
named
org.apache.river.thread.ThreadPool
to
log information at the following levels:
Level | Description |
---|---|
WARNING | uncaught exception in worker thread |
Modifier and Type | Class and Description |
---|---|
private static class |
ThreadPool.Task
Task simply encapsulates a task's Runnable object with its name.
|
private static class |
ThreadPool.TPThreadFactory
Thread stack size hint given to jvm to minimise memory consumption
as this executor can create many threads, tasks executed are relatively
simple and don't need much memory.
|
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ExecutorService |
es |
private static Logger |
logger |
private boolean |
shutdown
This Executor is used by JERI (and other Jini implementation classes)
to delegate tasks to, the intent is to hand off to a new thread
immediately, however:
1.
|
Modifier | Constructor and Description |
---|---|
private |
ThreadPool(java.util.concurrent.ExecutorService es) |
(package private) |
ThreadPool(ThreadGroup threadGroup) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable command) |
void |
execute(Runnable runnable,
String name)
Executes the given Runnable action asynchronously in some thread.
|
private Thread |
shutdownHook() |
private static final Logger logger
private volatile boolean shutdown
private final java.util.concurrent.ExecutorService es
ThreadPool(ThreadGroup threadGroup)
private ThreadPool(java.util.concurrent.ExecutorService es)
private Thread shutdownHook()
public void execute(Runnable runnable, String name) throws java.util.concurrent.RejectedExecutionException
Executor
runnable
- the Runnable action to executename
- string to include in the name of the thread used
to execute the actionjava.util.concurrent.RejectedExecutionException
public void execute(Runnable command)
execute
in interface java.util.concurrent.Executor
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.