org.locomotive.loco.servlet
Interface ServletFactoryListener

All Known Implementing Classes:
ServletPool, ServletRoutingTable.ServletEntry

public interface ServletFactoryListener
extends java.util.EventListener

A ServletFactoryListener is any Object that implements this interface and is interested in the events (and Objects) generated by a ServletFactory. Usually, a ServletFactoryListener is an Object that is using a ServletFactory to instantiate and initialize a servlet (or servlets) for it. We'll call that listener a "primary listener". But, ServletFactory and this Listener interface were written so any Object could also listen in to the events generated by a ServletFactory -- for monitoring reasons. Any listener that is simply monitoring the ServletFactory's activity in this way should be thought of as a "secondary listener". Primary listeners are instances of classes like ServletPool, that actually use the servlets that the ServletFactory is making. Any/all secondary listeners are just listening in. A ServletFactory will broadcast its events to all of its listeners.

Author:
Jason Brittain

Method Summary
 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.
 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.
 

Method Detail

getMinServletCount

public 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.

getMaxServletCount

public 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.. If the listener has all the servlets it needs, then the ServletFactory doesn't need to make any more unless the primary listener asks for more.

getCurrentServletCount

public 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.

handleServletFactoryEvent

public 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. In the case that a new servlet instance is ready, the new servlet is encapsulated inside the ServletFactoryEvent that is passed to this method. It is up to the ServletFactoryListener to make the servlet available to clients.

Parameters:
servlet_factory_event - an EventObject subclass from the ServletFactory that (in this case) encapsulates a new servlet that is ready to serve requests.
See Also:
ServletFactoryEvent