|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.radekzitek.userver.HandlerPool
HandlerPool is used to manage pools of the various handlers used in the run time. The HandlerPool maintains two vectors for each class of handler - pool vector with available handlers and active vector with handlers which were provided to the listeners to serve the clients.
Field Summary | |
(package private) java.util.Hashtable |
classActives
Table with the active vectors for all the classes. |
(package private) java.util.Hashtable |
classPools
Table with the pool vectors for all the classes. |
private static int |
idNumber
Static field used to for unique id of the created handlers. |
private static org.apache.log4j.Logger |
LOG
Log4j logger. |
Constructor Summary | |
HandlerPool()
Constructor for the HandlerPool. |
Method Summary | |
private java.util.Vector |
getClassActive(java.lang.Class handlerClass)
Provides the active vector for the given class. |
private java.util.Vector |
getClassPool(java.lang.Class handlerClass)
Provides the pool vector for the given class. |
HandlerThread |
getHandler(java.lang.Class handlerClass)
Provides handler of the given class to the listener. |
void |
returnHandler(HandlerThread handler)
Returns the handler into the pool. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.log4j.Logger LOG
private static int idNumber
java.util.Hashtable classPools
java.util.Hashtable classActives
Constructor Detail |
public HandlerPool()
Method Detail |
public HandlerThread getHandler(java.lang.Class handlerClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
handlerClass
- the class of the handler to be provided
java.lang.IllegalAccessException
- Thrown when the new handler can not be instantiated.
java.lang.InstantiationException
- Thrown when the new handler can not be instantiated.private java.util.Vector getClassPool(java.lang.Class handlerClass)
handlerClass
- the class for which the pool vector is needed
private java.util.Vector getClassActive(java.lang.Class handlerClass)
handlerClass
- the class for which the active vector is needed
public void returnHandler(HandlerThread handler)
handler
- the handler to be returned
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |