final class ThreadPool extends Object implements Executor
This implementation uses the Logger
named
com.sun.jini.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 class |
ThreadPool.Worker
Worker executes an initial task, and then it executes tasks from the
queue, passing away if ever idle for more than the idle timeout value.
|
Modifier and Type | Field and Description |
---|---|
private int |
idleThreads
threads definitely available to take new tasks
|
private static long |
idleTimeout
how long a thread waits in the idle state before passing away
|
private Object |
lock
lock guarding all mutable instance state (below)
|
private static Logger |
logger |
private LinkedList |
queue
queues of tasks to execute
|
private ThreadGroup |
threadGroup
thread group that this pool's threads execute in
|
Constructor and Description |
---|
ThreadPool(ThreadGroup threadGroup)
Creates a new thread group that executes tasks in threads of
the given thread group.
|
private static final long idleTimeout
private static final Logger logger
private final ThreadGroup threadGroup
private final Object lock
private int idleThreads
private final LinkedList queue
ThreadPool(ThreadGroup threadGroup)
public void execute(Runnable runnable, String name)
Executor
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.