Apache Async Http Client



    • Field Summary

      Fields
      Modifier and TypeField and Description
      protected org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandlercallbackHandler
      protected NMClientclient
    • Constructor Summary

      Constructors
      ModifierConstructor and Description
      protected NMClientAsync(org.apache.hadoop.yarn.client.api.async.NMClientAsync.AbstractCallbackHandler callbackHandler)
      protected NMClientAsync(org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler callbackHandler)
      Deprecated.
      Use NMClientAsync(AbstractCallbackHandler) instead.
      protected NMClientAsync(String name, org.apache.hadoop.yarn.client.api.async.NMClientAsync.AbstractCallbackHandler callbackHandler)
      protected NMClientAsync(String name, org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler callbackHandler)
      Deprecated.
      Use NMClientAsync(String, AbstractCallbackHandler) instead.
      protected NMClientAsync(String name, NMClient client, org.apache.hadoop.yarn.client.api.async.NMClientAsync.AbstractCallbackHandler callbackHandler)
      protected NMClientAsync(String name, NMClient client, org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler callbackHandler)
    • Method Summary

      All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete MethodsDeprecated Methods
      Modifier and TypeMethod and Description
      abstract voidcommitLastReInitializationAsync(ContainerId containerId)
      Commit last reInitialization of the specified container.
      static NMClientAsynccreateNMClientAsync(org.apache.hadoop.yarn.client.api.async.NMClientAsync.AbstractCallbackHandler callbackHandler)
      static NMClientAsynccreateNMClientAsync(org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler callbackHandler)
      Deprecated.
      Use createNMClientAsync(AbstractCallbackHandler) instead.
      org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandlergetCallbackHandler()
      NMClientgetClient()
      abstract voidgetContainerStatusAsync(ContainerId containerId, NodeId nodeId)
      abstract voidincreaseContainerResourceAsync(Container container)
      abstract voidreInitializeContainerAsync(ContainerId containerId, ContainerLaunchContext containerLaunchContex, boolean autoCommit)
      Re-Initialize the Container.
      abstract voidrestartContainerAsync(ContainerId containerId)
      abstract voidrollbackLastReInitializationAsync(ContainerId containerId)
      Rollback last reInitialization of the specified container.
      voidsetCallbackHandler(org.apache.hadoop.yarn.client.api.async.NMClientAsync.CallbackHandler callbackHandler)
      voidsetClient(NMClient client)
      abstract voidstartContainerAsync(Container container, ContainerLaunchContext containerLaunchContext)
      abstract voidstopContainerAsync(ContainerId containerId, NodeId nodeId)
      abstract voidupdateContainerResourceAsync(Container container)
      • Methods inherited from class org.apache.hadoop.service.AbstractService

        close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
HttpApache httpclient example
  1. Async Http Client (AHC) Component. Available as of Camel 2.8. The ahc: component provides HTTP based endpoints for consuming external HTTP resources (as a client to call external servers using HTTP). The component uses the Async Http Client library. Maven users will need to add the following dependency to their pom.xml for this component.
  2. Apache HTTP Client is a very mature project with plenty of build-in functionality and hooks to customize it. It even has an async module and the newer 5.0 (beta) version comes with build-in async functionality. In our case, after this long explanation to my colleague, given our use cases, moving to Asynchronous HTTP Client was my suggestion.

Apache Async Http Client Connection Pool

Below is the method thats cauing the exception. Public Optional execute (HttpUriRequest request, CloseableHttpAsyncClient closeableHttpAsyncClient, long timeout) HttpResponse response = null; try final Future future = closeableHttpAsyncClient.execute (request, null); // Throwing IllegalStateException: Request cannot.