se.unlogic.standardutils.threads
Class ThreadPoolTaskGroupHandler<T extends TaskGroup>
java.lang.Object
se.unlogic.standardutils.threads.ThreadPoolTaskGroupHandler<T>
- All Implemented Interfaces:
- java.lang.Runnable, TaskGroupHandler<T,SimpleExecutionController<T>>
public class ThreadPoolTaskGroupHandler<T extends TaskGroup>
- extends java.lang.Object
- implements TaskGroupHandler<T,SimpleExecutionController<T>>, java.lang.Runnable
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
taskGroupRemoveLock
protected final java.util.concurrent.locks.ReentrantLock taskGroupRemoveLock
taskGroupRemoveCondition
protected final java.util.concurrent.locks.Condition taskGroupRemoveCondition
taskGroupAddLock
protected final java.util.concurrent.locks.ReentrantLock taskGroupAddLock
taskGroupAddCondition
protected final java.util.concurrent.locks.Condition taskGroupAddCondition
taskGroupList
protected final java.util.concurrent.CopyOnWriteArrayList<SimpleExecutionController<T extends TaskGroup>> taskGroupList
taskGroupIndex
protected int taskGroupIndex
status
protected Status status
threads
protected final java.util.ArrayList<java.lang.Thread> threads
ThreadPoolTaskGroupHandler
public ThreadPoolTaskGroupHandler(int poolSize,
boolean daemon)
run
public void run()
- Specified by:
run
in interface java.lang.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 java.util.concurrent.RejectedExecutionException
- Specified by:
execute
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
java.util.concurrent.RejectedExecutionException
getTaskGroupCount
public int getTaskGroupCount()
- Specified by:
getTaskGroupCount
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
getTaskGroups
public java.util.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 java.lang.InterruptedException
- Specified by:
awaitTermination
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
java.lang.InterruptedException
awaitTermination
public void awaitTermination(long timeout)
throws java.lang.InterruptedException
- Specified by:
awaitTermination
in interface TaskGroupHandler<T extends TaskGroup,SimpleExecutionController<T extends TaskGroup>>
- Throws:
java.lang.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.