java.lang.Object
dev.civl.gmc.concurrent.MyThreadPool
The threadPool That is used to manage the threads used in the algorithm.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidDecrease the counter for waiting threads.intintintvoidvoidIncrease the counter for waiting threads.booleanvoidshutdown()voidsubmit(ForkJoinTask<Integer> task)
-
Constructor Details
-
MyThreadPool
public MyThreadPool(int parallelism) -
MyThreadPool
public MyThreadPool()
-
-
Method Details
-
incrementWaiting
public void incrementWaiting()Increase the counter for waiting threads. -
decrementWaiting
public void decrementWaiting()Decrease the counter for waiting threads. -
incrementTotal
public void incrementTotal() -
decrementTotal
public void decrementTotal() -
getActiveNum
public int getActiveNum()- Returns:
- the number of threads that are currently executing (not include waiting threads).
-
getRunningNum
public int getRunningNum()- Returns:
- the total number of threads (include threads that are waiting).
-
submit
-
isQuiescent
public boolean isQuiescent() -
getMaxNumOfThread
public int getMaxNumOfThread() -
shutdown
public void shutdown()
-