|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--ThreadManager
Manager for the threads. Every threads is used for a connection for downloading a part of the ressource.
| Field Summary | |
(package private) static int |
activeThreads
|
(package private) static int |
existingThreads
|
private int |
maxSpareThreads
|
private int |
maxThreads
|
private int |
minSpareThreads
|
private int |
minThreads
|
| Constructor Summary | |
ThreadManager()
Creates a new ThreadManager with default values as attributs. maxThreads = 50; minThreads = 5; maxSpareThreads = 5; minSpareThreads = 5; It doesn't create new Threads. |
|
ThreadManager(int maxThreads,
int minThreads,
int maxSpareThreads,
int minSpareThreads)
It sets the bounds for the Threads, but it doesn't create new Threads. |
|
| Method Summary | |
void |
initialize(java.lang.Class runnableClass)
Method that creates minThreads Threads |
boolean |
mustCreateThread()
This method return true if a new Thread must be created |
boolean |
mustDestroyThread()
This method return true if an existing Thread must be destroyed |
void |
newThread(java.lang.Class runnableClass)
Method that creates a new Thread, starts it and update attributs of the ThreadManager. |
void |
oneLessActiveThread()
This method decrements the number of activated Threads Attention!! |
void |
oneLessExistingThread()
This method decrements the number of existing Threads Attention!! |
void |
oneMoreActiveThread()
This method increments the number of activated Threads Attention!! |
java.lang.String |
printStatus()
This method returns a String describing the number of existing and activated Threads. |
void |
setAttributs(int maxThreads,
int minThreads,
int maxSpareThreads,
int minSpareThreads)
This method changes the bounds for the number of Threads |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private int maxThreads
private int minThreads
private int maxSpareThreads
private int minSpareThreads
static int existingThreads
static int activeThreads
| Constructor Detail |
public ThreadManager()
public ThreadManager(int maxThreads,
int minThreads,
int maxSpareThreads,
int minSpareThreads)
throws IllegalValuesException
maxThreads - maximum number of existing ThreadsminThreads - minimum number of existing ThreadsmaxSpareThreads - maximum number of disactivated ThreadsminSpareThreads - minimum number of disactivated Threads| Method Detail |
public void initialize(java.lang.Class runnableClass)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
c - Class extending Runnable, every new Thread manages a
new object of this class
public void setAttributs(int maxThreads,
int minThreads,
int maxSpareThreads,
int minSpareThreads)
throws IllegalValuesException
maxThreads - new maximum number of existing ThreadsminThreads - new minimum number of existing ThreadsmaxSpareThreads - new maximum number of disactivated ThreadsminSpareThreads - new minimum number of disactivated ThreadsIllegalValuesException - public java.lang.String printStatus()
public void newThread(java.lang.Class runnableClass)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
objectRunnable - An object instance of Runnable,
managed by a new ThreadInstantiationException, - IllegalAccessExceptionpublic void oneMoreActiveThread()
public void oneLessActiveThread()
public void oneLessExistingThread()
public boolean mustCreateThread()
public boolean mustDestroyThread()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||