|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.util.ObjectPool | +--org.locomotive.loco.servlet.ServletPool
Holds a pool of servlets. It's used in the ServletRoutingTable for Servlets that implement SingleThreadModel. This creates some servlets (currently, the number of minimum Threads that are created at startup), and scales to a maximum number of servlets (currently the maximum number of request Threads that are allowed by the server). This ServletPool class works in conjunction with the ServletFactory to create and maintain a pool of servlets that are ready to serve requests.
Inner classes inherited from class org.locomotive.util.ObjectPool |
ObjectPool.PoolEntry |
Fields inherited from class org.locomotive.util.ObjectPool |
classname,
current_open,
isRunning,
log,
log_level,
max_open,
min_open,
pe_in_use_hash,
pe_stack,
poolentry_id_sequence |
Constructor Summary | |
protected |
ServletPool(java.lang.Class servlet_class,
javax.servlet.ServletConfig servlet_config,
ServletRoutingTable.ServletEntry servlet_entry)
Creates the new ServletPool. |
Method Summary | |
java.lang.Object |
createNewObject()
ServletPool does not need an implementation of this method, since the ServletFactory creates them for ServletPool and hands them over when they're ready to serve. |
void |
destroyObject(java.lang.Object obj)
Calls destroy() |
int |
getCurrentServletCount()
The ServletFactory calls this method when it needs to know how many servlets that the primary listener (like a ServletPool or a ServletEntry) currently holds. |
int |
getMaxServletCount()
The ServletFactory calls this method when it needs to know the maximum number of servlets that the primary listener (like a ServletPool or a ServletEntry) will hold.. |
int |
getMinServletCount()
The ServletFactory calls this method when it needs to know how many servlets that the primary listener (like a ServletPool or a ServletEntry) needs to keep active and ready to serve. |
java.lang.Object |
getObject()
Use this method to get a servlet from the ServletPool. |
ServletFactory |
getServletFactory()
Returns a reference to this ServletPool's ServletFactory Object. |
javax.servlet.Servlet |
getServletFromPool()
Gets a servlet from this pool. |
void |
handleServletFactoryEvent(ServletFactoryEvent servlet_factory_event)
The ServletFactory calls this method when it has either successfully instantiated and initialized a servlet (and the new servlet is ready to serve requests), or when the ServletFactory needs to signal the ServletFactoryListener(s) that some other event has occurred. |
void |
initialize()
This method overrides ObjectPool.initialize(). |
void |
returnToPool(java.lang.Object obj)
Checks to make sure that the Object you're trying to return is an instance of a Servlet, and if so this method returns that Servlet instance to the pool. |
void |
setMaxSize(int maxSize)
Set the maximum size of the object pool. |
void |
setMinSize(int minSize)
Set the minimum size of the ServletPool. |
void |
setServletFactory(ServletFactory new_servlet_factory)
|
void |
wipeFromPool(java.lang.Object obj)
This method overrides ObjectPool.wipeFromPool(Object). |
Methods inherited from class org.locomotive.util.ObjectPool |
closeCurrentPoolMembers,
getLogLevel,
getMaxSize,
getMinSize,
getNextId,
getPoolSize,
isRunning,
log,
logError,
setLog,
setLogLevel,
startService,
stopService |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
protected ServletPool(java.lang.Class servlet_class, javax.servlet.ServletConfig servlet_config, ServletRoutingTable.ServletEntry servlet_entry) throws InitializationException
servlet_class
- the class of servlets that will populate this
ServletPool.servlet_config
- the ServletConfig Object that holds any config
information for the servlets to use.Method Detail |
public void initialize() throws InitializationException
public java.lang.Object createNewObject() throws InitializationException
public java.lang.Object getObject()
public javax.servlet.Servlet getServletFromPool()
public void wipeFromPool(java.lang.Object obj)
obj
- the Object to remove from the pool.public void destroyObject(java.lang.Object obj)
public void returnToPool(java.lang.Object obj)
public void setMinSize(int minSize)
ObjectPool.setMinSize()
. This
implementation also notifies the ServletFactory of the change
(if there is one).
minSize
- The minimum size of the object pool.public void setMaxSize(int maxSize)
ObjectPool.setMaxSize()
. This
implementation also notifies the ServletFactory of the change
(if there is one).
maxSize
- The maximum size of the object pool.public ServletFactory getServletFactory()
public void setServletFactory(ServletFactory new_servlet_factory)
public int getMinServletCount()
public int getMaxServletCount()
public int getCurrentServletCount()
public void handleServletFactoryEvent(ServletFactoryEvent servlet_factory_event)
servlet_factory_event
- an event that tells this
ServletFactoryListener Object that a servlet is
ready to serve requests (in which case the servlet
is encapsulated in the event Object), or that the
servlet is unavailable.ServletFactoryEvent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |