All Packages Class Hierarchy This Package Previous Next Index
Class javax.servlet.UnavailableException
java.lang.Object
|
+----java.lang.Throwable
|
+----java.lang.Exception
|
+----javax.servlet.ServletException
|
+----javax.servlet.UnavailableException
- public class UnavailableException
- extends ServletException
This exception indicates that a servlet is unavailable. Servlets
may report this exception at any time, and the network service
running the servlet should behave appropriately. There are two
types of unavailability, and sophisticated services will to deal
with these differently:
- Permanent unavailability. The servlet will not be
able to handle client requests until some administrative action is
taken to correct a servlet problem. For example, the servlet might
be misconfigured, or the state of the servlet may be corrupted.
Well written servlets will log both the error and the corrective
action which an administrator must perform to let the servlet
become available.
- Temporary unavailability. The servlet can not handle
requests at this moment due to a 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. The
problem may be self correcting, such as those due to excessive
load, or corrective action may need to be taken by an
administrator.
Network services may safely treat both types of exceptions as
"permanent", but good treatment of temporary unavailability leads
to more robust network services. Specifically, requests to the
servlet might be blocked (or otherwise deferred) for a
servlet-suggested amount of time, rather than being rejected until
the service itself restarts.
-
UnavailableException(int, Servlet, String)
- Constructs a new exception with the specified descriptive message,
indicating that the servlet is temporarily unavailable and giving
an estimate of how long it will be unavailable.
-
UnavailableException(Servlet, String)
-
Constructs a new exception with the specified descriptive
message, indicating that the servlet is permanently
unavailable.
-
getServlet()
- Returns the servlet that is reporting its unavailability.
-
getUnavailableSeconds()
- Returns the amount of time the servlet expects to be temporarily
unavailable.
-
isPermanent()
- Returns true if the servlet is "permanently" unavailable,
indicating that the service administrator must take some
corrective action to make the servlet be usable.
UnavailableException
public UnavailableException(Servlet servlet,
String msg)
- Constructs a new exception with the specified descriptive
message, indicating that the servlet is permanently
unavailable.
- Parameters:
- servlet - the servlet which is unavailable
- msg - the descriptive message
UnavailableException
public UnavailableException(int seconds,
Servlet servlet,
String msg)
- Constructs a new exception with the specified descriptive message,
indicating that the servlet is temporarily unavailable and giving
an estimate of how long it will be unavailable. In some cases, no
estimate can be made; this is indicated by a non-positive time.
For example, the servlet might know a server it needs is "down",
but not be able to report how long it will take to restore it to
an adequate level of functionality.
- Parameters:
- seconds - number of seconds that the servlet is anticipated
to be unavailable. If negative or zero, no estimate is available.
- servlet - the servlet which is unavailable
- msg - the descriptive message
isPermanent
public boolean isPermanent()
- Returns true if the servlet is "permanently" unavailable,
indicating that the service administrator must take some
corrective action to make the servlet be usable.
getServlet
public Servlet getServlet()
- Returns the servlet that is reporting its unavailability.
getUnavailableSeconds
public int getUnavailableSeconds()
- Returns the amount of time the servlet expects to be temporarily
unavailable. If the servlet is permanently unavailable, or no
estimate was provided, returns a negative number. No effort is
made to correct for the time elapsed since the exception was
first reported.
All Packages Class Hierarchy This Package Previous Next Index