org.locomotive.loco.servlet
Class ServletRoutingTable.ServletEntry

java.lang.Object
  |
  +--org.locomotive.server.ServiceRoutingTable.ServiceEntry
        |
        +--org.locomotive.loco.servlet.ServletRoutingTable.ServletEntry
Enclosing class:
ServletRoutingTable

public class ServletRoutingTable.ServletEntry
extends ServiceRoutingTable.ServiceEntry
implements ServletFactoryListener


Field Summary
protected  ServletFactory servlet_factory
          We keep a reference to our ServletFactory -- it makes servlets for us in another Thread.
 
Fields inherited from class org.locomotive.server.ServiceRoutingTable.ServiceEntry
availability, cached, classname, config_path, last_availability_event_timestamp, pattern, props, service, theclass, unavailability_reason, unavailable_seconds
 
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 ServletRoutingTable) 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 ServletRoutingTable) 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 ServletRoutingTable) needs to keep active and ready to serve.
protected  javax.servlet.Servlet getServlet()
          Give out the Servlet, but only to classes within the same package.
 ServletFactory getServletFactory()
          Returns a reference to this ServletPool's ServletFactory Object.
 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.
protected  void initialize()
          This needs to be overridden to instantiate and create the service.
 void setServletFactory(ServletFactory new_servlet_factory)
           
 boolean shutdown(Log server_log)
          Shuts down the service for this ServletEntry.
 boolean shutdown(javax.servlet.Servlet servlet_instance, Log server_log)
          Shuts down just the specified servlet instance for this ServletEntry.
 
Methods inherited from class org.locomotive.server.ServiceRoutingTable.ServiceEntry
getAvailability, getLastAvailabilityEventTimestamp, getService, getUnavailabilityReason, getUnavailableSeconds, load, setAvailability, setLastAvailabilityEventTimestamp, setUnavailabilityReason, setUnavailableSeconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servlet_factory

protected ServletFactory servlet_factory
We keep a reference to our ServletFactory -- it makes servlets for us in another Thread.
See Also:
ServletFactory
Method Detail

initialize

protected void initialize()
                   throws InitializationException
Description copied from class: ServiceRoutingTable.ServiceEntry
This needs to be overridden to instantiate and create the service. You should catch all exceptions and rethrow them as InitializationExceptions. You Should never need to call this- load(), above, will call it, after the properties file has been loaded.
Overrides:
initialize in class ServiceRoutingTable.ServiceEntry

shutdown

public boolean shutdown(Log server_log)
Shuts down the service for this ServletEntry.
Overrides:
shutdown in class ServiceRoutingTable.ServiceEntry

shutdown

public boolean shutdown(javax.servlet.Servlet servlet_instance,
                        Log server_log)
Shuts down just the specified servlet instance for this ServletEntry. Call this method when you want to destroy and de-reference just an individual servlet instance.

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 ServletRoutingTable) needs to keep active and ready to serve.

This implementation in ServletEntry will just return a value of one, since ServletEntry just needs to hold just one servlet if the ServletEntry isn't using a ServletPool.
Specified by:
getMinServletCount in interface ServletFactoryListener

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 ServletRoutingTable) 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.

This implementation in ServletEntry will just return a value of one, since ServletEntry just needs to hold a maximum of one multithreaded servlet (the ServletEntry isn't using a ServletPool).
Specified by:
getMaxServletCount in interface ServletFactoryListener

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 ServletRoutingTable) currently holds.
Specified by:
getCurrentServletCount in interface ServletFactoryListener

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.

Specified by:
handleServletFactoryEvent in interface ServletFactoryListener
Parameters:
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.
See Also:
ServletFactoryEvent

getServletFactory

public ServletFactory getServletFactory()
Returns a reference to this ServletPool's ServletFactory Object. If one doesn't already exist, a new one is instantiated, and a reference to it is returned.

Returns:
a reference to this ServletPool's ServletFactory.

setServletFactory

public void setServletFactory(ServletFactory new_servlet_factory)

getServlet

protected javax.servlet.Servlet getServlet()
Give out the Servlet, but only to classes within the same package.