Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UnavailableException

 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UnavailableException
What is the UnavailableException exception in case of the servlets and how is it diffenrent from the ServletException??
Ehn it is to be used..
can anyone quote a simple example.???
 
Munish Dabra
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think UnavailableException is thrown in the init() method .The method is generally overridden to give one time intialization of the servlet.If for some reason this intialization fails,one should throw an UnavailableException.
This exception can also take an int argument specifying how long the server should wait before attempting to instantiate the servlet again.
For more details see the init() Life cycle method in specification.
 
Krishna Srinivasan
Ranch Hand
Posts: 1876
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unavailable exceprion is subclass of ServletException.This exception will be thrown if it does't find the specified servlet in the container.
The servlets methods (init,service,etc.) not thrown UnavailableException.These methods will throw only ServletException & IOException.
 
Krishna Srinivasan
Ranch Hand
Posts: 1876
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Defines an exception that a servlet or filter throws to indicate that it is permanently or temporarily unavailable.
When a servlet or filter is permanently unavailable, something is wrong with the it, and it cannot handle requests until some action is taken. For example, a servlet might be configured incorrectly, or a filter's state may be corrupted. The component should log both the error and the corrective action that is needed.
A servlet or filter is temporarily unavailable if it cannot handle requests momentarily due to some system-wide problem. For example, a third-tier server might not be accessible, or there may be insufficient memory or disk storage to handle requests. A system administrator may need to take corrective action.
Servlet containers can safely treat both types of unavailable exceptions in the same way. However, treating temporary unavailability effectively makes the servlet container more robust. Specifically, the servlet container might block requests to the servlet or filter for a period of time suggested by the exception, rather than rejecting them until the servlet contai
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishna,
U say following:
--------------------- Original Message ---------------------
Unavailable exceprion is subclass of ServletException.This exception will be thrown if it does't find the specified servlet in the container.
The servlets methods (init,service,etc.) not thrown UnavailableException.These methods will throw only ServletException & IOException.
--------------------
Krishna Srinivasan
--------------------- Original Message ---------------------
Why do you think the servlets methods (init,service,etc.) can not throw UnavailableException? If methods can throw ServletException, it can very well throw Unavailable exception that being a subclass of ServletException
Can you please clarify?
Sandesh
 
Krishna Srinivasan
Ranch Hand
Posts: 1876
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
servlet methods can throw UnavailbleException...sorry i made mistake..
 
Krishna Srinivasan
Ranch Hand
Posts: 1876
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unavailbele exception will throw if the container not found the specified resource in the servlet container.but the init,service.etc..will be called after creating the instance of the servlets...so, i am not sure wheter it can throw ....
this exception is handled by servlet container...
u clarify with some expets...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic