org.jclouds.http.internal
Class BaseHttpCommandExecutorService<Q>

java.lang.Object
  extended by org.jclouds.http.internal.BaseHttpCommandExecutorService<Q>
All Implemented Interfaces:
HttpCommandExecutorService
Direct Known Subclasses:
ApacheHCHttpCommandExecutorService, GaeHttpCommandExecutorService, JavaUrlHttpCommandExecutorService

public abstract class BaseHttpCommandExecutorService<Q>
extends Object
implements HttpCommandExecutorService

Author:
Adrian Cole

Nested Class Summary
 class BaseHttpCommandExecutorService.HttpResponseCallable
           
 
Field Summary
protected  Logger headerLog
           
protected  Logger logger
           
protected  HttpUtils utils
           
protected  HttpWire wire
           
 
Constructor Summary
protected BaseHttpCommandExecutorService(HttpUtils utils, ExecutorService ioWorkerExecutor, DelegatingRetryHandler retryHandler, IOExceptionRetryHandler ioRetryHandler, DelegatingErrorHandler errorHandler, HttpWire wire)
           
 
Method Summary
protected abstract  void cleanup(Q nativeResponse)
           
static InputStream consumeOnClose(InputStream in)
           
protected abstract  Q convert(HttpRequest request)
           
protected abstract  HttpResponse invoke(Q nativeRequest)
           
 Future<HttpResponse> submit(HttpCommand command)
          Asks the command to build a request relevant for an endpoint that produces responses of generic type HttpResponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

utils

protected final HttpUtils utils

logger

protected Logger logger

headerLog

@Named(value="jclouds.headers")
protected Logger headerLog

wire

protected final HttpWire wire
Constructor Detail

BaseHttpCommandExecutorService

@Inject
protected BaseHttpCommandExecutorService(HttpUtils utils,
                                                @Named(value="jclouds.io-worker-threads")
                                                ExecutorService ioWorkerExecutor,
                                                DelegatingRetryHandler retryHandler,
                                                IOExceptionRetryHandler ioRetryHandler,
                                                DelegatingErrorHandler errorHandler,
                                                HttpWire wire)
Method Detail

consumeOnClose

public static InputStream consumeOnClose(InputStream in)

submit

public Future<HttpResponse> submit(HttpCommand command)
Description copied from interface: HttpCommandExecutorService
Asks the command to build a request relevant for an endpoint that produces responses of generic type HttpResponse. and invokes it on the endpoint, returning a future

Specified by:
submit in interface HttpCommandExecutorService
Parameters:
command - that generates requests
Returns:
Future containing the response from the endpoint

convert

protected abstract Q convert(HttpRequest request)
                      throws IOException,
                             InterruptedException
Throws:
IOException
InterruptedException

invoke

protected abstract HttpResponse invoke(Q nativeRequest)
                                throws IOException,
                                       InterruptedException
Throws:
IOException
InterruptedException

cleanup

protected abstract void cleanup(Q nativeResponse)


Copyright © 2009-2011 jclouds. All Rights Reserved.