|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Waiter
Provides blocking or callback behavior for asynchronous methods.
In a servlet, it's bad practice to actually block a method call because threads are a limited resource. As an alternative, some servlet containers allow you to register a request to be suspended and later resumed/retried (examples: Jetty Continuations, Java Servlet 3.0 suspendable requests).
This interface abstracts away the differences between blocking and callback implementations of asynchrony so the underlying implementation doesn't have to know about them.
This is not thread-safe -- you are expected to call it from within a block synchronized on the monitor.
Method Summary | |
---|---|
void |
resume()
Signal that the asynchronous call should be resumed. |
void |
suspend(java.lang.Object monitor)
Suspend the current request and release locks. |
Method Detail |
---|
void suspend(java.lang.Object monitor) throws java.lang.InterruptedException
monitor
- the monitor to wait on if a blocking implementation is used.
java.lang.InterruptedException
- if the call timed out.void resume()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |