Examples of ReadHandler


Examples of com.cognitect.transit.ReadHandler

        this.arrayBuilder = arrayBuilder;
    }

    protected Object decode(String tag, Object rep) {

        ReadHandler d = handlers.get(tag);
        if(d != null) {
            return d.fromRep(rep);
        } else if(defaultHandler != null) {
            return defaultHandler.fromRep(tag, rep);
        } else {
            throw new RuntimeException("Cannot fromRep " + tag + ": " + rep.toString());
        }
View Full Code Here

Examples of org.apache.ambari.server.api.handlers.ReadHandler

    return Type.GET;
  }

  @Override
  protected RequestHandler getRequestHandler() {
    return new ReadHandler();
  }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

     * This method shouldn't be invoked by developers directly.
     */
    protected void finished() {
        if (!contentRead) {
            contentRead = true;
            final ReadHandler localHandler = handler;
            if (localHandler != null) {
                handler = null;
                invokeHandlerAllRead(localHandler, getThreadPool());
            }
        }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

            if (closed) {
                buffer.dispose();
                return false;
            }
           
            final ReadHandler localHandler = handler;
           
            final boolean isLast = httpContent.isLast();
           
            // if we have a handler registered - switch the flag to true
            boolean askForMoreDataInThisThread = !isLast && localHandler != null;
            boolean invokeDataAvailable = false;

            if (buffer.hasRemaining()) {
                updateInputContentBuffer(buffer);
                if (localHandler != null) {
                    final int available = readyData();
                    if (available >= requestedSize) {
                        invokeDataAvailable = true;
                        askForMoreDataInThisThread = false;
                    }
                }
            }
           
            if (askForMoreDataInThisThread) {
                // There is a ReadHandler registered, but it requested more
                // data to be available before we can notify it - so wait for
                // more data to come
                isWaitingDataAsynchronously = true;
                return true;
            }
           
            handler = null;
           
            if (isLast) {
                checkHttpTrailer(httpContent);
            }
           
            invokeHandlerOnProperThread(localHandler,
                    invokeDataAvailable, isLast);
           
        } else { // broken content
            final ReadHandler localHandler = handler;
            handler = null;
            invokeErrorHandlerOnProperThread(localHandler,
                                             ((HttpBrokenContent) httpContent).getException());
        }
       
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

     * </p>
     *
     * @since 2.0.1
     */
    public void terminate() {
        final ReadHandler localHandler = handler;
        if (localHandler != null) {
            handler = null;
            // call in the current thread, because otherwise handler executed
            // in the different thread may deal with recycled Request/Response objects
            localHandler.onError(
                    connection.isOpen()
                    ? new CancellationException()
                    : new EOFException());
        }
    }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

        final HttpContext context = HttpContext.get(ctx);
        if (context != null) {
            final Request request = httpRequestInProgress.get(context);

            if (request != null) {
                final ReadHandler handler = request.getInputBuffer().getReadHandler();
                if (handler != null) {
                    handler.onError(error);
                }
            }
        }
    }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

    public void exceptionOccurred(FilterChainContext ctx, Throwable error) {
        final HttpContext context = HttpContext.get(ctx);
        final Request request = httpRequestInProgress.get(context);

        if (request != null) {
            final ReadHandler handler = request.getInputBuffer().getReadHandler();
            if (handler != null) {
                handler.onError(error);
            }
        }
    }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

     * This method shouldn't be invoked by developers directly.
     */
    public void finished() {
        if (!contentRead) {
            contentRead = true;
            final ReadHandler localHandler = handler;
            if (localHandler != null) {
                handler = null;
                invokeHandlerAllRead(localHandler, getThreadPool());
            }
        }
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

            if (closed) {
                buffer.dispose();
                return false;
            }
           
            final ReadHandler localHandler = handler;
           
            final boolean isLast = httpContent.isLast();
           
            // if we have a handler registered - switch the flag to true
            boolean askForMoreDataInThisThread = !isLast && localHandler != null;
            boolean invokeDataAvailable = false;

            if (buffer.hasRemaining()) {
                updateInputContentBuffer(buffer);
                if (localHandler != null) {
                    final int available = readyData();
                    if (available >= requestedSize) {
                        invokeDataAvailable = true;
                        askForMoreDataInThisThread = false;
                    }
                }
            }
           
            if (askForMoreDataInThisThread) {
                // There is a ReadHandler registered, but it requested more
                // data to be available before we can notify it - so wait for
                // more data to come
                isWaitingDataAsynchronously = true;
                return true;
            }
           
            handler = null;
           
            if (isLast) {
                checkHttpTrailer(httpContent);
            }
           
            invokeHandlerOnProperThread(localHandler,
                    invokeDataAvailable, isLast);
           
        } else { // broken content
            final ReadHandler localHandler = handler;
            handler = null;
            invokeErrorHandlerOnProperThread(localHandler,
                                             ((HttpBrokenContent) httpContent).getException());
        }
       
View Full Code Here

Examples of org.glassfish.grizzly.ReadHandler

     * </p>
     *
     * @since 2.0.1
     */
    public void terminate() {
        final ReadHandler localHandler = handler;
        if (localHandler != null) {
            handler = null;
            if (connection.isOpen()) {
                invokeErrorHandlerOnProperThread(localHandler,
                                                 new CancellationException());
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.