Package io.ably.lib.http

Class HttpScheduler

java.lang.Object
io.ably.lib.http.HttpScheduler
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
AsyncHttpScheduler, SyncHttpScheduler

public class HttpScheduler extends Object implements AutoCloseable
HttpScheduler schedules HttpCore operations to an Executor, exposing a generic async API. Internal; use Http instead.
  • Field Details

    • TAG

      protected static final String TAG
  • Constructor Details

  • Method Details

    • get

      public <T> Future<T> get(String path, Param[] headers, Param[] params, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP GET for Ably host, with fallbacks
      Parameters:
      path -
      headers -
      params -
      responseHandler -
      callback -
    • put

      public <T> Future<T> put(String path, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP PUT for Ably host, with fallbacks
      Parameters:
      path -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
    • post

      public <T> Future<T> post(String path, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP POST for Ably host, with fallbacks
      Parameters:
      path -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
    • patch

      public <T> Future<T> patch(String path, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP PATCH for Ably host, with fallbacks
      Parameters:
      path -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
    • del

      public <T> Future<T> del(String path, Param[] headers, Param[] params, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP DEL for Ably host, with fallbacks
      Parameters:
      path -
      headers -
      params -
      responseHandler -
      callback -
    • exec

      public <T> Future<T> exec(String path, String method, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Async HTTP request for Ably host, with fallbacks
      Parameters:
      path -
      method -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • httpExecute

      public <T> Future<T> httpExecute(URL url, String method, Param[] headers, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, Callback<T> callback)
      Make an asynchronous HTTP request to a given URL
      Parameters:
      url -
      method -
      headers -
      requestBody -
      responseHandler -
      callback -
      Returns:
    • ablyHttpExecuteWithFallback

      public <T> Future<T> ablyHttpExecuteWithFallback(String path, String method, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Make an asynchronous HTTP request to an Ably endpoint, using the Ably auth credentials and fallback hosts if necessary
      Parameters:
      path -
      method -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
      Returns:
    • ablyHttpExecuteWithRetry

      public <T> Future<T> ablyHttpExecuteWithRetry(String host, String path, String method, Param[] headers, Param[] params, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
      Make an asynchronous HTTP request to an Ably endpoint, using the Ably auth credentials and reauthentication if necessary
      Parameters:
      host -
      path -
      method -
      headers -
      params -
      requestBody -
      responseHandler -
      callback -
      Returns:
    • execute

      public void execute(Runnable runnable)
      Adds a Runnable to the Executor used by this scheduler instance.
      Parameters:
      runnable - The code to be executed.