Document the state transition diagram
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Jun 2011 20:10:23 +0000 (20:10 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Jun 2011 20:10:23 +0000 (20:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1134063 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/AsyncStateMachine.java

index b71a4ac..8665ab1 100644 (file)
@@ -24,8 +24,8 @@ import org.apache.tomcat.util.res.StringManager;
 
 /**
  * Manages the state transitions for async requests.
- * TODO: State transition diagram
  * 
+ * <pre>
  * The internal states that are used are:
  * DISPATCHED    - Standard request. Not in Async mode.
  * STARTING      - ServletRequest.startAsync() has been called but the
@@ -48,6 +48,41 @@ import org.apache.tomcat.util.res.StringManager;
  *                 request finishes, the dispatch() will be processed.
  * DISPATCHING   - The dispatch is being processed.
  * ERROR         - Something went wrong.
+ *
+ * |----------------->---------------|                                         
+ * |                                \|/                                        
+ * |   |----------<----------------ERROR                                    
+ * |   |    complete()            /|\  |                                       
+ * |   |                    error()|   |postProcess()                          
+ * |   |                           |   |                                       
+ * |   |           postProcess()   |  \|/         auto                         
+ * |   |         |--------------->DISPATCHED<------------------COMPLETING<----| 
+ * |   |         |               /|\  |                          | /|\        | 
+ * |   |         |    |--->-------|   |                          |--|         | 
+ * |   |         ^    |               |startAsync()            timeout()      |
+ * |   |         |    |               |                                       | 
+ * |  \|/        |    |  complete()  \|/        postProcess()                 | 
+ * | MUST_COMPLETE-<- | ----<------STARTING-->----------------|               ^     
+ * |      /|\         |               |                       |               |         
+ * |       |          |               |                       |               |         
+ * |       |          ^               |dispatch()             |               |         
+ * |       |          |               |                       |               |         
+ * |       |          |              \|/                     \|/   complete() |         
+ * |       |          |         MUST_DISPATCH              STARTED---->-------|   
+ * |       |          |           |                         |   |                        
+ * |       |          |           |postProcess()            |   |                        
+ * ^       ^          |           |              dispatch() |   |auto                        
+ * |       |          |           |    |--------------------|   |                        
+ * |       |          | auto     \|/  \|/                      \|/                         
+ * |       |          |---<----DISPATCHING<-----------------TIMING_OUT                              
+ * |       |                                  dispatch()      |   |             
+ * |       |                                                  |   |            
+ * |       |-------<-------------------------------------<----|   |            
+ * |                              complete()                      |            
+ * |                                                              |            
+ * |----<------------------------<-----------------------------<--|            
+ *                                 error()
+ * </pre>                               
  */
 public class AsyncStateMachine {