Do you know where your time is spent on startup?

Is it bytecode scanning? (by servlet spec requirements in jetty? or by your
3rd party libs?)
Is it annotation scanning? (by servlet spec requirements in jetty? or by
your 3rd party libs?)
I'm not familiar with "ContextLoaderListener", as that's not a term in the
servlet spec.
Perhaps you meant
https://docs.oracle.com/javaee/7/api/javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-
?

If startup time is important, then start moving away from runtime assembly
of the webapp to build-time, such as doing things with statically defined
configurations (many build tools can do this in an automatic fashion for
you).
For pure Servlet behaviors, Jetty even has a quickstart featureset that
will perform the initialization phase of the servlet spec during build-time
of your war, and will then produce a WEB-INF/jetty-quickstart.xml that
short circuits all of the servlet spec bytecode scanning and annotation
scanning, making startup of servlet features super quick.

Whatever decision you go with, be aware that changes to the configuration
of the WebApp can only occur during the servlet initialization phase, once
that's done you can no longer change the state of the configuration (such
as removing/adding servlets and filters).

Joakim Erdfelt / [email protected]


On Thu, Mar 4, 2021 at 4:39 AM Tarun Sharma <[email protected]>
wrote:

> Hi All,
> I have a webapp on jetty which uses spring beans. I am using the listener
> class of type 'ContextLoaderListener' to initialize the spring context and
> then invoke some "startup action" on the beans. This "startup action" is
> taking long on some occasions leading to delayed webapp startup. Is there a
> way to move this action out of webapplication deployment so that my web
> application is available quickly?
> A concept of a delayed scheduled task might come handy.
> Please suggest.
>
> Regards,
> Tarun
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to