Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.AsyncContinuation$AsyncEventState


    public void handle(String target, Request request,
                       HttpServletRequest httpRequest, HttpServletResponse httpResponse)
            throws IOException, ServletException {
        activeDispatches.inc();

        final AsyncContinuation continuation = request.getAsyncContinuation();

        final long start;
        final boolean isMilliseconds;

        if (continuation.isInitial()) {
            activeRequests.inc();
            start = request.getTimeStamp();
            isMilliseconds = true;
        } else {
            activeSuspendedRequests.dec();
            if (continuation.isResumed()) {
                resumes.mark();
            }
            isMilliseconds = false;
            start = System.nanoTime();
        }

        try {
            super.handle(target, request, httpRequest, httpResponse);
        } finally {
            if (isMilliseconds) {
                final long duration = System.currentTimeMillis() - start;
                dispatches.update(duration, TimeUnit.MILLISECONDS);
                requestTimer(request.getMethod()).update(duration, TimeUnit.MILLISECONDS);
            } else {
                final long duration = System.nanoTime() - start;
                dispatches.update(duration, TimeUnit.NANOSECONDS);
                requestTimer(request.getMethod()).update(duration, TimeUnit.NANOSECONDS);
            }

            activeDispatches.dec();
            if (continuation.isSuspended()) {
                if (continuation.isInitial()) {
                    continuation.addContinuationListener(listener);
                }
                suspends.mark();
                activeSuspendedRequests.inc();
            } else if (continuation.isInitial()) {
                updateResponses(request);
            }
        }
    }
View Full Code Here


     */
    @Override
    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException
    {
        AsyncContinuation continuation = baseRequest.getAsyncContinuation();
        if (!continuation.isInitial())
        {
            baseRequest.setDispatchTime(System.currentTimeMillis());
        }
       
        try
View Full Code Here

    {
        Handler[] handlers = getHandlers();
        if (handlers==null || handlers.length==0)
      return;
 
  AsyncContinuation async = baseRequest.getAsyncContinuation();
  if (async.isAsync())
  {
      ContextHandler context=async.getContextHandler();
      if (context!=null)
      {
          context.handle(target,baseRequest,request, response);
          return;
      }
View Full Code Here

    public void handle(String path, Request request, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException, ServletException
    {
        _dispatchedStats.increment();

        final long start;
        AsyncContinuation continuation = request.getAsyncContinuation();
        if (continuation.isInitial())
        {
            // new request
            _requestStats.increment();
            start = request.getTimeStamp();
        }
        else
        {
            // resumed request
            start = System.currentTimeMillis();
            _suspendStats.decrement();
            if (continuation.isResumed())
                _resumes.incrementAndGet();
        }

        try
        {
            super.handle(path, request, httpRequest, httpResponse);
        }
        finally
        {
            final long now = System.currentTimeMillis();
            final long dispatched=now-start;
           
            _dispatchedStats.decrement();
            _dispatchedTimeStats.set(dispatched);
           
            if (continuation.isSuspended())
            {
                if (continuation.isInitial())
                    continuation.addContinuationListener(_onCompletion);
                _suspendStats.increment();
            }
            else if (continuation.isInitial())
            {
                _requestStats.decrement();
                _requestTimeStats.set(dispatched);
                updateResponse(request);
            }
View Full Code Here

                // if this is an internal jetty retry, then just tell
                // jetty we're still working on it. There is a risk of
                // masking other errors in doing this, but it's probably
                // low compared with the default policy of retrys.
                AsyncContinuation cont = baseRequest.getAsyncContinuation();
                // this is set to false on internal jetty retrys
                if (!cont.isInitial()) {
                    // The continuation object has been woken up by the
                    // retry. Tell it to go back to sleep.
                    cont.suspend();
                    return;
                }

                //Special handling for API as they continue and setHandled differently
                if (baseRequest.getRequestURI().contains("/api/1.0/")) {
View Full Code Here

    public void handle(String target, Request request,
                       HttpServletRequest httpRequest, HttpServletResponse httpResponse)
            throws IOException, ServletException {
        activeDispatches.inc();

        final AsyncContinuation continuation = request.getAsyncContinuation();

        final long start;
        final boolean isMilliseconds;

        if (continuation.isInitial()) {
            activeRequests.inc();
            start = request.getTimeStamp();
            isMilliseconds = true;
        } else {
            activeSuspendedRequests.dec();
            if (continuation.isResumed()) {
                resumes.mark();
            }
            isMilliseconds = false;
            start = System.nanoTime();
        }

        try {
            super.handle(target, request, httpRequest, httpResponse);
        } finally {
            if (isMilliseconds) {
                final long duration = System.currentTimeMillis() - start;
                dispatches.update(duration, TimeUnit.MILLISECONDS);
                requestTimer(request.getMethod()).update(duration, TimeUnit.MILLISECONDS);
            } else {
                final long duration = System.nanoTime() - start;
                dispatches.update(duration, TimeUnit.NANOSECONDS);
                requestTimer(request.getMethod()).update(duration, TimeUnit.NANOSECONDS);
            }

            activeDispatches.dec();
            if (continuation.isSuspended()) {
                if (continuation.isInitial()) {
                    continuation.addContinuationListener(listener);
                }
                suspends.mark();
                activeSuspendedRequests.inc();
            } else if (continuation.isInitial()) {
                updateResponses(request);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.AsyncContinuation$AsyncEventState

Copyright © 2018 www.massapicom. 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.