Unavailable Exception

Hi, I was going through the Servlet Specs. In Sec 2.3.2.1, it says that when the Unavailable Exception is thrown, the destroy() is not called as it is considered an unsuccesful initialisation.

But in Sec 2.3.2.2, it says when the Unavailable Exception is thrown, the destroy() will be called.

Please clarify on this.

Ganesh

Narendra Dhande

Ranch Hand

Posts: 951

posted 10 years ago

Originally posted by Ganesh.P Ram: Hi, I was going through the Servlet Specs. In Sec 2.3.2.1, it says that when the Unavailable Exception is thrown, the destroy() is not called as it is considered an unsuccesful initialisation.

But in Sec 2.3.2.2, it says when the Unavailable Exception is thrown, the destroy() will be called.

Please clarify on this.

The SVR 2.3.2.1 is about loading and initialization of Servlet. When the Unavilable exception is thrown in the init method, the servlet is not loaded in the container, so it will not called the destroy method.

The second section you mentioned is I think 2.3.3.2. This section is related to already running servlet. That is the sevlet is loaded and initialized successfully and processing some request. In this case when the UnavailableException occurs It must run its destroy method to clean up the resources.