public Future<T> executeAsync(final RestCallback<T> handler) {

        return client.submit(new Callable<T>() {

            @Override
            public T call() throws Exception {
                try {
                    final T result = execute();
                    handler.completed(result, RestRequest.this);
                    return result;
                } catch (Exception e) {
                    handler.failed(e, RestRequest.this);
                    throw e;
                }
            }
        });
    }
public Future < T > executeAsync ( final RestCallback < T > handler ) { return client . submit ( new Callable < T > ( ) { @ Override public T call ( ) throws Exception { try { final T result = execute ( ) ; handler . completed ( result , RestRequest . this ) ; return result ; } catch ( Exception e ) { handler . failed ( e , RestRequest . this ) ; throw e ; } } } ) ; }
Execute the REST request asynchronously and call the given handler when the operation
completes. The handler runs on the REST client's executor service.

@param handler the handler to run once the request completes, or failure occurs.
@return A future result of the asynchronous operation.