se.unlogic.standardutils.threads
Class ThreadPoolTaskGroupHandler<T extends TaskGroup>
java.lang.Object
se.unlogic.standardutils.threads.ThreadPoolTaskGroupHandler<T>
- All Implemented Interfaces:
- Runnable, TaskGroupHandler<T,SimpleExecutionController<T>>
public class ThreadPoolTaskGroupHandler<T extends TaskGroup>
- extends Object
- implements TaskGroupHandler<T,SimpleExecutionController<T>>, Runnable
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
taskGroupRemoveLock
protected final ReentrantLock taskGroupRemoveLock
taskGroupRemoveCondition
protected final Condition taskGroupRemoveCondition
taskGroupAddLock
protected final ReentrantLock taskGroupAddLock
taskGroupAddCondition
protected final Condition taskGroupAddCondition
taskGroupList
protected final CopyOnWriteArrayList<SimpleExecutionController<T extends TaskGroup>> taskGroupList
taskGroupIndex
protected int taskGroupIndex
status
protected Status status
threads
protected final ArrayList<Thread> threads
ThreadPoolTaskGroupHandler
public ThreadPoolTaskGroupHandler(int poolSize,
boolean daemon)
run
public void run()
- Specified by:
run
in interface Runnable
isEmpty
public boolean isEmpty()
getLiveThreads
public int getLiveThreads()
getIndex
protected int getIndex()
abortAllTaskGroups
public void abortAllTaskGroups()
- Specified by:
abortAllTaskGroups
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
execute
public SimpleExecutionController<T> execute(T taskGroup)
throws RejectedExecutionException
- Specified by:
execute
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
RejectedExecutionException
getTaskGroupCount
public int getTaskGroupCount()
- Specified by:
getTaskGroupCount
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
getTaskGroups
public List<SimpleExecutionController<T>> getTaskGroups()
- Specified by:
getTaskGroups
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
getTotalTaskCount
public int getTotalTaskCount()
- Specified by:
getTotalTaskCount
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
getStatus
public Status getStatus()
- Specified by:
getStatus
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
awaitTermination
public void awaitTermination()
throws InterruptedException
- Specified by:
awaitTermination
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
InterruptedException
awaitTermination
public void awaitTermination(long timeout)
throws InterruptedException
- Specified by:
awaitTermination
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
InterruptedException
shutdown
public void shutdown()
- Specified by:
shutdown
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
Copyright © 2011. All Rights Reserved.