com.github.axet.wget
Class LimitThreadPool
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.github.axet.wget.LimitThreadPool
- All Implemented Interfaces:
- Executor, ExecutorService
public class LimitThreadPool
- extends ThreadPoolExecutor
| Methods inherited from class java.util.concurrent.ThreadPoolExecutor |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated |
LimitThreadPool
public LimitThreadPool(int maxThreadCount)
beforeExecute
protected void beforeExecute(Thread t,
Runnable r)
- Overrides:
beforeExecute in class ThreadPoolExecutor
afterExecute
protected void afterExecute(Runnable r,
Throwable t)
- Overrides:
afterExecute in class ThreadPoolExecutor
active
public boolean active()
- downloader working if here any getTasks() > 0
waitUntilNextTaskEnds
public void waitUntilNextTaskEnds()
throws InterruptedException
- Wait until current task ends. if here is no tasks exit immidiatly.
- Throws:
InterruptedException
waitUntilTermination
public void waitUntilTermination()
throws InterruptedException
- Wait until thread pool execute its last task. Waits forever unti end.
- Throws:
InterruptedException
execute
public void execute(Runnable command)
- You should not call this method on this Limited Version Thread Pool. Use
blockExecute() instead.
- Specified by:
execute in interface Executor- Overrides:
execute in class ThreadPoolExecutor
blockExecute
public void blockExecute(Runnable command)
throws InterruptedException
- Throws:
InterruptedException
Copyright © 2012. All Rights Reserved.