|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectHTTPClient.IdempotentSequence
This class checks whether a sequence of requests is idempotent. This is used to determine which requests may be automatically retried. This class also serves as a central place to record which methods have side effects and which methods are idempotent.
Note: unknown methods (i.e. a method which is not HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, or UNLOCK) are treated conservatively, meaning they are assumed to have side effects and are not idempotent.
Usage:
IdempotentSequence seq = new IdempotentSequence();
seq.add(r1);
...
if (seq.isIdempotent(r1)) ...
...
| Constructor Summary | |
IdempotentSequence()
Start a new sequence of requests. |
|
| Method Summary | |
void |
add(Request req)
Add the request to the end of the list of requests. |
boolean |
isIdempotent(Request req)
Is this request part of an idempotent sequence? This method must not be called before all requests have been added to this sequence; similarly, add() must not be called after this method was invoked. |
static void |
main(String[] args)
Test code. |
static boolean |
methodHasSideEffects(String method)
|
static boolean |
methodIsComplete(String method)
A method is complete if any side effects of the request affect the complete resource. |
static boolean |
methodIsIdempotent(String method)
A method is idempotent if the side effects of N identical requests is the same as for a single request (Section 9.1.2 of RFC-????). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public IdempotentSequence()
| Method Detail |
public void add(Request req)
req - the next requestpublic boolean isIdempotent(Request req)
We split up the sequence of requests into individual sub-sequences, or threads, with all requests in a thread having the same request-URI and no two threads having the same request-URI. Each thread is then marked as idempotent or not according to the following rules:
The major assumption here is that the side effects of any method only apply to resource specified. E.g. a "PUT /barbara.html" will only affect the resource "/barbara.html" and nothing else. This assumption is violated by POST of course; however, POSTs are not pipelined and will therefore never show up here.
req - the requestpublic static boolean methodIsIdempotent(String method)
public static boolean methodIsComplete(String method)
public static boolean methodHasSideEffects(String method)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||