tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject [PROPOSAL] Make Lifecycle mandatory rather than optional
Date Mon, 15 Feb 2010 10:23:01 GMT
Currently, Lifecycle is an optional interface for components. I'd like
to make it mandatory for Server, Service and Container.

My reasons for this are:
1. Much of the current implementation depends on Lifecycle (e.g. JNDI,
configuration) and breaks if the component doesn't implement Lifecycle

2. There is a lot of casting to StandardXXX to access Lifecycle methods
that could be removed. This would enable a much wider use of interfaces
rather than concrete classes throughout the codebase.

3. Lifecycle is easy to implement, particularly with the
LifecycleSupport class

4. Implementing some of the Servlet 3.0 dynamic configuration requires
knowledge of the Context Lifecycle so Context is going to have to
support Lifecycle, possible with some additions to that interface.[1]

Whilst making Lifecycle mandatory, does add an additional burden for
those writing custom Tomcat components I would argue that the savings
from addressing point 2 (which would be eased by this change and the
associated clean-up) more than outweighs the burden from point 3.

Unless there are any objections, I plan to start implementing this in
the next day or so.



[1] Note the current Servlet 3.0 implementation for dynamic
configuration whilst it looks complete won't actually work. The
Lifecycle changes are required to Context to get this working.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message