Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!

How set timeout for Servlet

Avatar

Former Community Member

Hi,
I've developed a servlet to AEM.
The Servlet works correctly, but I wanted to better understand its life cycle.
Especially, once the servlet is invoked how to set a timeout for its execution, if it never ends its operations, and how to handle the release of its resources - all within the context of AEM.
I did some testing, and from what I see it seems that once the servlet is started you can't stop it
I tried to set the a t imeout by turning based configuration of this service "Jetty based Apache Felix HTTP Service"
(from the Configuration Manager) but without success

I had a look at this thread [http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...] and seems that it's not possible to manage the life cycle of a servlet

Thanks for the help and support

2 Replies

Avatar

Level 10

"but I wanted to better understand its life cycle"

Read about Sling  Servlets here: https://sling.apache.org/documentation/the-sling-engine/servlets.html

Avatar

Former Community Member

Hi Scott,
thank you for your reply

I following your suggestion to read the documentation, in particular this paragraph: "servlet-lifecycle-issues" https://sling.apache.org/documentation/the-sling-engine/servlets.html#servlet-lifecycle-issues
And to me seems that once a servlet is instantiated, it's not possible to stop it.

Because the requirement I have, i thinking if there is a way to check the progress of the Servlet?
Or if could be a useful way try to instantiate threads for each request and manage their live-cycle?