comparison src/org/eclipse/jetty/server/AsyncContinuation.java @ 938:a088981f9cd4

remove more async code
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Oct 2016 23:48:32 -0600
parents 0541b6034003
children
comparison
equal deleted inserted replaced
937:0541b6034003 938:a088981f9cd4
16 // ======================================================================== 16 // ========================================================================
17 // 17 //
18 18
19 package org.eclipse.jetty.server; 19 package org.eclipse.jetty.server;
20 20
21 import org.eclipse.jetty.io.EndPoint;
22 import org.slf4j.Logger; 21 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
24 23
25 24
26 public final class AsyncContinuation 25 public final class AsyncContinuation
27 { 26 {
28 private static final Logger LOG = LoggerFactory.getLogger(AsyncContinuation.class); 27 private static final Logger LOG = LoggerFactory.getLogger(AsyncContinuation.class);
29
30 private final static long DEFAULT_TIMEOUT=30000L;
31 28
32 // STATES: 29 // STATES:
33 // handling() suspend() unhandle() resume() complete() doComplete() 30 // handling() suspend() unhandle() resume() complete() doComplete()
34 // startAsync() dispatch() 31 // startAsync() dispatch()
35 // IDLE DISPATCHED 32 // IDLE DISPATCHED
45 private static final int __IDLE=0; // Idle request 42 private static final int __IDLE=0; // Idle request
46 private static final int __DISPATCHED=1; // Request dispatched to filter/servlet 43 private static final int __DISPATCHED=1; // Request dispatched to filter/servlet
47 private static final int __UNCOMPLETED=8; // Request is completable 44 private static final int __UNCOMPLETED=8; // Request is completable
48 private static final int __COMPLETED=9; // Request is complete 45 private static final int __COMPLETED=9; // Request is complete
49 46
50 /* ------------------------------------------------------------ */
51 protected AbstractHttpConnection _connection;
52
53 /* ------------------------------------------------------------ */
54 private int _state; 47 private int _state;
55 48
56 AsyncContinuation() 49 AsyncContinuation()
57 { 50 {
58 _state=__IDLE; 51 _state=__IDLE;
59 } 52 }
60 53
61 protected synchronized void setConnection(final AbstractHttpConnection connection)
62 {
63 _connection=connection;
64 }
65
66
67 @Override 54 @Override
68 public synchronized String toString() 55 public synchronized String toString()
69 { 56 {
70 return super.toString()+"@"+getStatusString(); 57 return super.toString()+"@"+getStatusString();
71 } 58 }
135 case __DISPATCHED: 122 case __DISPATCHED:
136 throw new IllegalStateException(getStatusString()); 123 throw new IllegalStateException(getStatusString());
137 default: 124 default:
138 _state=__IDLE; 125 _state=__IDLE;
139 } 126 }
140 cancelTimeout();
141 } 127 }
142 128
143 private void cancelTimeout()
144 {
145 EndPoint endp=_connection.getEndPoint();
146 if (endp.isBlocking())
147 {
148 synchronized(this)
149 {
150 this.notifyAll();
151 }
152 }
153 }
154
155 synchronized boolean isUncompleted() 129 synchronized boolean isUncompleted()
156 { 130 {
157 return _state==__UNCOMPLETED; 131 return _state==__UNCOMPLETED;
158 } 132 }
159 } 133 }