Package org.apache.http.concurrent

Examples of org.apache.http.concurrent.Cancellable


    public void closed(final NHttpServerConnection conn) {
        State state = getState(conn);
        if (state != null) {
            state.setTerminated();
            closeHandlers(state);
            Cancellable cancellable = state.getCancellable();
            if (cancellable != null) {
                cancellable.cancel();
            }
            state.reset();
        }
    }
View Full Code Here


            final NHttpServerConnection conn, final Exception cause) {
        State state = ensureNotNull(getState(conn));
        if (state != null) {
            state.setTerminated();
            closeHandlers(state, cause);
            Cancellable cancellable = state.getCancellable();
            if (cancellable != null) {
                cancellable.cancel();
            }
            if (cause instanceof HttpException) {
                if (conn.isResponseSubmitted()
                        || state.getResponseState().compareTo(MessageState.INIT) > 0) {
                    // There is not much that we can do if a response
View Full Code Here

    public void closed(final NHttpServerConnection conn) {
        final State state = getState(conn);
        if (state != null) {
            state.setTerminated();
            closeHandlers(state);
            final Cancellable cancellable = state.getCancellable();
            if (cancellable != null) {
                cancellable.cancel();
            }
            state.reset();
        }
    }
View Full Code Here

            log(cause);
            return;
        }
        state.setTerminated();
        closeHandlers(state, cause);
        final Cancellable cancellable = state.getCancellable();
        if (cancellable != null) {
            cancellable.cancel();
        }
        if (conn.isResponseSubmitted()
                || state.getResponseState().compareTo(MessageState.INIT) > 0) {
            // There is not much that we can do if a response
            // has already been submitted
View Full Code Here

    public void closed(final NHttpServerConnection conn) {
        State state = getState(conn);
        if (state != null) {
            state.setTerminated();
            closeHandlers(state);
            Cancellable cancellable = state.getCancellable();
            if (cancellable != null) {
                cancellable.cancel();
            }
            state.reset();
        }
    }
View Full Code Here

            final NHttpServerConnection conn, final Exception cause) {
        State state = ensureNotNull(getState(conn));
        if (state != null) {
            state.setTerminated();
            closeHandlers(state, cause);
            Cancellable cancellable = state.getCancellable();
            if (cancellable != null) {
                cancellable.cancel();
            }
            if (cause instanceof HttpException) {
                if (conn.isResponseSubmitted()
                        || state.getResponseState().compareTo(MessageState.INIT) > 0) {
                    // There is not much that we can do if a response
View Full Code Here

    @Test
    public void testRequestCancelled() throws Exception {
       
        final CountDownLatch latch = new CountDownLatch(1);
        final Cancellable cancellable = new Cancellable() {
           
            public boolean cancel() {
                latch.countDown();
                return true;
            }
View Full Code Here

    @Test
    public void testPipeliningWithCancellable() throws Exception {

        final CountDownLatch latch = new CountDownLatch(1);
        final Cancellable cancellable = new Cancellable() {

            public boolean cancel() {
                latch.countDown();
                return true;
            }
View Full Code Here

    }

    @Test
    public void testPipeliningWithCancellable() throws Exception {

        final Cancellable cancellable = Mockito.mock(Cancellable.class);

        HttpAsyncRequestHandlerRegistry registry = new HttpAsyncRequestHandlerRegistry();
        registry.register("/long", new HttpAsyncRequestHandler<HttpRequest>() {

            public HttpAsyncRequestConsumer<HttpRequest> processRequest(final HttpRequest request,
View Full Code Here

        State state = getState(conn);
        if (state != null) {
            synchronized (state) {
                state.setTerminated();
                closeHandlers(state);
                Cancellable cancellable = state.getCancellable();
                if (cancellable != null) {
                    cancellable.cancel();
                }
                state.reset();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.http.concurrent.Cancellable

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.