Package javax.servlet

Examples of javax.servlet.AsyncContext.complete()


                        try {
                            ServletResponse response = asyncContext.getResponse();
                            PrintWriter out = response.getWriter();
                            out.write(data);
                            out.flush();
                            asyncContext.complete();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
View Full Code Here


                    try {
                        ServletResponse response = asyncContext.getResponse();
                        PrintWriter out = response.getWriter();
                        out.write(data);
                        out.flush();
                        asyncContext.complete();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
View Full Code Here

            }

            @Override
            public void onTimeout(final AsyncEvent event) throws IOException {
                System.out.println("=====async timeout");
                asyncContext.complete(); //需要调用下complete 否则如jetty默认每2秒重新调度一次当前方法
            }

            @Override
            public void onError(final AsyncEvent event) throws IOException {
                System.out.println("=====async error");
View Full Code Here

            }

            @Override
            public void onTimeout(final AsyncEvent event) throws IOException {
                System.out.println("=====async timeout");
                asyncContext.complete(); //需要调用下complete 否则如jetty默认每2秒重新调度一次当前方法
            }

            @Override
            public void onError(final AsyncEvent event) throws IOException {
                System.out.println("=====async error");
View Full Code Here

                    } catch (SuspendExecution e) {
                        throw new AssertionError(e);
                    }
                } else {
                    out.close();
                    ctx.complete();
                }
                return true;
            } catch (IOException ex) {
                request.getServletContext().log("IOException", ex);
                ctx.complete();
View Full Code Here

                    ctx.complete();
                }
                return true;
            } catch (IOException ex) {
                request.getServletContext().log("IOException", ex);
                ctx.complete();
                this.exception = ex;
                return false;
            }
        }
View Full Code Here

//                    suspendableService(srad, res);
                } catch (Exception ex) {
                    log("Exception in fiber servlet", ex);
                } finally {
                    if (req.isAsyncStarted())
                        ac.complete();
                    currentAsyncContext.set(null);
                }
            }
        }).start();
    }
View Full Code Here

                    suspendableService(srad, res);
                } catch (Exception ex) {
                    log("Exception in fiber servlet", ex);
                } finally {
                    if (req.isAsyncStarted())
                        ac.complete();
                    currentAsyncContext.set(null);
                }
            }
        }).start();
    }
View Full Code Here

    asyncContext.addListener(new AsyncListener() {
        @Override
        public void onComplete(final AsyncEvent event) throws IOException {
          synchronized (queue.getActivationLock()) {
            queue.setActivationCallback(null);
            asyncContext.complete();
          }
        }

        @Override
        public void onTimeout(final AsyncEvent event) throws IOException {
View Full Code Here

      });

    synchronized (queue.getActivationLock()) {
      if (queue.messagesWaiting()) {
        queue.poll(writer);
        asyncContext.complete();
        return;
      }

      queue.setActivationCallback(new QueueActivationCallback() {
        @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.