comparison src/org/eclipse/jetty/server/AsyncContinuation.java @ 929:3191abe890ef

remove isInitial()
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Oct 2016 19:13:46 -0600
parents 23a57aad34c0
children cd080b7bcf49
comparison
equal deleted inserted replaced
928:23a57aad34c0 929:3191abe890ef
79 private List<AsyncListener> _asyncListeners; 79 private List<AsyncListener> _asyncListeners;
80 private List<ContinuationListener> _continuationListeners; 80 private List<ContinuationListener> _continuationListeners;
81 81
82 /* ------------------------------------------------------------ */ 82 /* ------------------------------------------------------------ */
83 private int _state; 83 private int _state;
84 private boolean _initial;
85 private volatile boolean _responseWrapped; 84 private volatile boolean _responseWrapped;
86 private long _timeoutMs=DEFAULT_TIMEOUT; 85 private long _timeoutMs=DEFAULT_TIMEOUT;
87 private AsyncEventState _event; 86 private AsyncEventState _event;
88 private volatile long _expireAt; 87 private volatile long _expireAt;
89 88
90 /* ------------------------------------------------------------ */ 89 /* ------------------------------------------------------------ */
91 protected AsyncContinuation() 90 protected AsyncContinuation()
92 { 91 {
93 _state=__IDLE; 92 _state=__IDLE;
94 _initial=true;
95 } 93 }
96 94
97 /* ------------------------------------------------------------ */ 95 /* ------------------------------------------------------------ */
98 protected void setConnection(final AbstractHttpConnection connection) 96 protected void setConnection(final AbstractHttpConnection connection)
99 { 97 {
176 public boolean isResponseWrapped() 174 public boolean isResponseWrapped()
177 { 175 {
178 return _responseWrapped; 176 return _responseWrapped;
179 } 177 }
180 178
181 /* ------------------------------------------------------------ */ 179 /*
182 /* (non-Javadoc)
183 * @see javax.servlet.ServletRequest#isInitial()
184 */
185 public boolean isInitial() 180 public boolean isInitial()
186 { 181 {
187 synchronized(this) 182 synchronized(this)
188 { 183 {
189 return _initial; 184 return true;
190 } 185 }
191 } 186 }
192 187 */
193 /* ------------------------------------------------------------ */ 188 /* ------------------------------------------------------------ */
194 /* (non-Javadoc) 189 /* (non-Javadoc)
195 * @see javax.servlet.ServletRequest#isSuspended() 190 * @see javax.servlet.ServletRequest#isSuspended()
196 */ 191 */
197 public boolean isSuspended() 192 public boolean isSuspended()
250 return 245 return
251 ((_state==__IDLE)?"IDLE": 246 ((_state==__IDLE)?"IDLE":
252 (_state==__DISPATCHED)?"DISPATCHED": 247 (_state==__DISPATCHED)?"DISPATCHED":
253 (_state==__UNCOMPLETED)?"UNCOMPLETED": 248 (_state==__UNCOMPLETED)?"UNCOMPLETED":
254 (_state==__COMPLETED)?"COMPLETE": 249 (_state==__COMPLETED)?"COMPLETE":
255 ("UNKNOWN?"+_state))+ 250 ("UNKNOWN?"+_state));
256 (_initial?",initial":""); 251 }
257 } 252 }
258 } 253
259 254 protected synchronized void handling()
260 /* ------------------------------------------------------------ */ 255 {
261 /** 256 switch(_state)
262 * @return false if the handling of the request should not proceed 257 {
263 */ 258 case __IDLE:
264 protected boolean handling() 259 _state=__DISPATCHED;
265 { 260 if (_asyncListeners!=null)
266 synchronized (this) 261 _asyncListeners.clear();
267 { 262 return;
268 switch(_state) 263
269 { 264 default:
270 case __IDLE: 265 throw new IllegalStateException(this.getStatusString());
271 _initial=true;
272 _state=__DISPATCHED;
273 if (_asyncListeners!=null)
274 _asyncListeners.clear();
275 return true;
276
277 default:
278 throw new IllegalStateException(this.getStatusString());
279 }
280 } 266 }
281 } 267 }
282 268
283 /* ------------------------------------------------------------ */ 269 /* ------------------------------------------------------------ */
284 /** 270 /**
299 default: 285 default:
300 throw new IllegalStateException(this.getStatusString()); 286 throw new IllegalStateException(this.getStatusString());
301 } 287 }
302 } 288 }
303 289
304 /* ------------------------------------------------------------ */
305 public void dispatch() 290 public void dispatch()
306 { 291 {
307 boolean dispatch=false; 292 throw new UnsupportedOperationException();
308 synchronized (this)
309 {
310 switch(_state)
311 {
312 default:
313 throw new IllegalStateException(this.getStatusString());
314 }
315 }
316 } 293 }
317 294
318 /* ------------------------------------------------------------ */ 295 /* ------------------------------------------------------------ */
319 protected void expired() 296 protected void expired()
320 { 297 {
446 case __DISPATCHED: 423 case __DISPATCHED:
447 throw new IllegalStateException(getStatusString()); 424 throw new IllegalStateException(getStatusString());
448 default: 425 default:
449 _state=__IDLE; 426 _state=__IDLE;
450 } 427 }
451 _initial = true;
452 _responseWrapped=false; 428 _responseWrapped=false;
453 cancelTimeout(); 429 cancelTimeout();
454 _timeoutMs=DEFAULT_TIMEOUT; 430 _timeoutMs=DEFAULT_TIMEOUT;
455 _continuationListeners=null; 431 _continuationListeners=null;
456 } 432 }
492 { 468 {
493 return _state==__COMPLETED; 469 return _state==__COMPLETED;
494 } 470 }
495 } 471 }
496 472
497 /* ------------------------------------------------------------ */
498 public void dispatch(ServletContext context, String path) 473 public void dispatch(ServletContext context, String path)
499 { 474 {
500 _event._dispatchContext=context; 475 throw new UnsupportedOperationException();
501 _event.setPath(path); 476 }
502 dispatch(); 477
503 }
504
505 /* ------------------------------------------------------------ */
506 public void dispatch(String path) 478 public void dispatch(String path)
507 { 479 {
508 _event.setPath(path); 480 throw new UnsupportedOperationException();
509 dispatch();
510 } 481 }
511 482
512 /* ------------------------------------------------------------ */ 483 /* ------------------------------------------------------------ */
513 public Request getBaseRequest() 484 public Request getBaseRequest()
514 { 485 {