StatefulServletContext¶
-
public class
StatefulServletContext
¶ A StatefulServletContext represents a context of a stateful servlet. A stateful servlet has two states, a halted state and a running state.
Author: Hugo Y. K. Lam See also:
StatefulServletContextListener
Constructors¶
Methods¶
acquire¶
-
public synchronized void
acquire
()¶ Acquires a permission from this context. Any servlet which employs this stateful context must call this method before processing any requests.
Throws: - UnavailableException – if the context is currently halted.
addContextListener¶
getContextListeners¶
-
public Collection
getContextListeners
()¶ Gets all the stateful servlet context listeners in this context.
Returns: all the stateful servlet context listeners in this context.
getCurrentThreadCount¶
-
public int
getCurrentThreadCount
()¶ Gets the current count of threads running under this context.
Returns: the current count of threads running under this context.
getRequestEncoding¶
getResponseEncoding¶
halt¶
-
public synchronized boolean
halt
()¶ Halts this context. The calling thread will be blocked until a lock on the context has been acquired and no more threads are running under this context. Nothing will be done if the servlet is already halted.
Returns: true if and only if this context is not halted or being halted.
isHalted¶
-
public boolean
isHalted
()¶ Checks if the context is currently halted.
Returns: true if the servlet is currently halted.
isHalting¶
-
public boolean
isHalting
()¶ Checks if the context is currently being halted.
Returns: true if the servlet is currently being halted.
release¶
-
public synchronized void
release
()¶ Releases a permission to this context. Any servlet which employs this stateful context must call this method after processing any requests.
resume¶
-
public synchronized boolean
resume
()¶ Resumes this context. The calling thread will be blocked until a lock on the context has been acquired. Nothing will be done if the servlet is not halted.
Returns: true if and only if this context is halted and not being halted.