Package org.glassfish.jersey.client.spi

Examples of org.glassfish.jersey.client.spi.AsyncConnectorCallback


                    return;
                }

                try {
                    final SettableFuture<ClientResponse> responseFuture = SettableFuture.create();
                    final AsyncConnectorCallback connectorCallback = new AsyncConnectorCallback() {

                        @Override
                        public void response(final ClientResponse response) {
                            responseFuture.set(response);
                        }
View Full Code Here


                    return;
                }

                try {
                    final SettableFuture<ClientResponse> responseFuture = SettableFuture.create();
                    final AsyncConnectorCallback connectorCallback = new AsyncConnectorCallback() {

                        @Override
                        public void response(final ClientResponse response) {
                            responseFuture.set(response);
                        }
View Full Code Here

        submit(asyncExecutorsFactory.getRequestingExecutor(request), new Runnable() {

            @Override
            public void run() {
                final RequestScope.Instance currentScopeInstance = requestScope.referenceCurrent();
                final AsyncConnectorCallback connectorCallback = new AsyncConnectorCallback() {

                    @Override
                    public void response(final ClientResponse response) {
                        submit(asyncExecutorsFactory.getRespondingExecutor(request), currentScopeInstance, new Runnable() {
                            @Override
                            public void run() {
                                final ClientResponse processedResponse;
                                try {
                                    processedResponse = Stages.process(response, responseProcessingRoot);
                                } catch (Throwable throwable) {
                                    failure(throwable);
                                    return;
                                }
                                try {
                                    callback.completed(processedResponse, requestScope);
                                } finally {
                                    currentScopeInstance.release();
                                }
                            }
                        });
                    }

                    @Override
                    public void failure(Throwable failure) {
                        try {
                            callback.failed(failure instanceof ProcessingException ?
                                    (ProcessingException) failure : new ProcessingException(failure));
                        } finally {
                            currentScopeInstance.release();
                        }
                    }
                };
                try {
                    connector.apply(addUserAgent(Stages.process(request, requestProcessingRoot), connector.getName()), connectorCallback);
                } catch (AbortException aborted) {
                    connectorCallback.response(aborted.getAbortResponse());
                } catch (Throwable throwable) {
                    connectorCallback.failure(throwable);
                }
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.client.spi.AsyncConnectorCallback

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.