Hi all,

IMHO we have an issue with Sling's access to Servlet registered as
services and provided as Resources in the Resource tree for handling
requests:

   * The Servlet services are eagerly accessed and initialized
     by the Sling Engine.
   * The Servlet services are eagerly accessed by the Servlet
     Resolver bundle to register them as Resources.
   * Initialization and use of the servlets is split between the
     Sling Engine and Servlet Resolver.

I think we should change this as follows:

  * All Servlet service handling is concentrated in the Servlet
    Resolver.
  * Servlet services are accessed on-demand only. This works
    because all information to register a servlet in the
    resource tree is provided as service registration properties

This allows for the registration of Servlet services as service
factories, e.g. by declaring the servlets as delayed compoents. This in
turn enables us to optimize resource consumption:

  * Upon startup, the servlets need not be instantiated, only
    the ServiceFactory needs to be registered.
  * As a consequence class loaders creation might be delayed.
  * Memory can be conserved by not creating objects which are
    never used or not used often.
  * Overall startup performance could be increased.


WDYT ?

Regards
Felix

Reply via email to