public class Jdk14ThreadPool extends Object implements ThreadPool
| 限定符和类型 | 类和说明 |
|---|---|
(专用程序包) static class |
Jdk14ThreadPool.DefaultPromise<R> |
(专用程序包) class |
Jdk14ThreadPool.IdleQueueKeeper
IdleQueueKeeper
|
(专用程序包) class |
Jdk14ThreadPool.PoolManager
PoolManager
|
(专用程序包) static class |
Jdk14ThreadPool.PromiseRunnable<R>
PromiseRunnable
|
(专用程序包) static class |
Jdk14ThreadPool.Reference<R>
Reference
|
(专用程序包) static class |
Jdk14ThreadPool.State |
(专用程序包) static class |
Jdk14ThreadPool.Sync
Sync
|
(专用程序包) class |
Jdk14ThreadPool.WorkerThread
WorkerThread
|
| 限定符和类型 | 字段和说明 |
|---|---|
private int |
maxQueueSize |
private Jdk14ThreadPool.PoolManager |
poolManager |
private RejectedExecutionHandler |
rejectedExecutionHandler |
private boolean |
running |
private Jdk14ThreadPool.State |
state |
private Jdk14ThreadPool.Sync |
sync |
private static long |
threadSerialNo |
private long |
timeout |
private Timer |
timer |
private LinkedList<Runnable> |
waitQueue |
| 构造器和说明 |
|---|
Jdk14ThreadPool(int maxPoolSize,
long timeout,
int queueSize) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterRun(Runnable r,
Throwable e) |
boolean |
apply(Runnable task) |
protected void |
beforeRun(Thread thread,
Runnable r) |
int |
getActiveThreadSize() |
long |
getCompletedTaskCount() |
long |
getFailedTaskCount() |
int |
getIdleThreadSize() |
int |
getMaxPoolSize() |
int |
getPoolSize() |
int |
getQueueSize() |
private static String |
getThreadName() |
boolean |
isShutdown() |
void |
keepIdleSize(int maxIdleSize,
long checkInterval) |
static void |
main(String[] args) |
static void |
main3(String[] args) |
protected Thread |
newThread(Runnable task) |
void |
setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) |
void |
shutdown() |
<R> Promise<R> |
submit(Action<R> action) |
(专用程序包) void |
submitAgainIfPresent() |
static void |
test1() |
static void |
test2() |
String |
toString() |
private void |
waitForNextExecuting(Runnable task) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexecuteprivate static long threadSerialNo
private final Jdk14ThreadPool.PoolManager poolManager
private final LinkedList<Runnable> waitQueue
private final int maxQueueSize
private final Jdk14ThreadPool.Sync sync
private final long timeout
private volatile boolean running
private Jdk14ThreadPool.State state
private Timer timer
private RejectedExecutionHandler rejectedExecutionHandler
public void keepIdleSize(int maxIdleSize,
long checkInterval)
public int getActiveThreadSize()
getActiveThreadSize 在接口中 ThreadPoolpublic int getIdleThreadSize()
getIdleThreadSize 在接口中 ThreadPoolpublic int getQueueSize()
getQueueSize 在接口中 ThreadPoolpublic int getPoolSize()
getPoolSize 在接口中 ThreadPoolpublic int getMaxPoolSize()
getMaxPoolSize 在接口中 ThreadPoolpublic long getCompletedTaskCount()
getCompletedTaskCount 在接口中 ThreadPoolpublic long getFailedTaskCount()
getFailedTaskCount 在接口中 ThreadPoolpublic void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
setRejectedExecutionHandler 在接口中 ThreadPoolprivate static String getThreadName()
public <R> Promise<R> submit(Action<R> action)
submit 在接口中 ThreadPoolpublic boolean apply(Runnable task)
apply 在接口中 ThreadPoolprivate void waitForNextExecuting(Runnable task)
public boolean isShutdown()
isShutdown 在接口中 ThreadPoolvoid submitAgainIfPresent()
public void shutdown()
shutdown 在接口中 ThreadPoolpublic static void main3(String[] args) throws IOException
IOExceptionpublic static void main(String[] args) throws IOException
IOExceptionpublic static void test1()
throws IOException
IOExceptionpublic static void test2()
throws IOException
IOExceptionCopyright © 2020. All rights reserved.