Class HttpScheduler

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

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

    Fields 
    Modifier and Type Field Description
    protected static java.lang.String TAG  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected HttpScheduler​(HttpCore httpCore, CloseableExecutor executor)  
  • Method Summary

    Modifier and Type Method Description
    <T> java.util.concurrent.Future<T> ablyHttpExecuteWithFallback​(java.lang.String path, java.lang.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
    <T> java.util.concurrent.Future<T> ablyHttpExecuteWithRetry​(java.lang.String host, java.lang.String path, java.lang.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
    void close()  
    <T> java.util.concurrent.Future<T> del​(java.lang.String path, Param[] headers, Param[] params, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
    Async HTTP DEL for Ably host, with fallbacks
    <T> java.util.concurrent.Future<T> exec​(java.lang.String path, java.lang.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
    void execute​(java.lang.Runnable runnable)
    Adds a Runnable to the Executor used by this scheduler instance.
    <T> java.util.concurrent.Future<T> get​(java.lang.String path, Param[] headers, Param[] params, HttpCore.ResponseHandler<T> responseHandler, boolean requireAblyAuth, Callback<T> callback)
    Async HTTP GET for Ably host, with fallbacks
    <T> java.util.concurrent.Future<T> httpExecute​(java.net.URL url, java.lang.String method, Param[] headers, HttpCore.RequestBody requestBody, HttpCore.ResponseHandler<T> responseHandler, Callback<T> callback)
    Make an asynchronous HTTP request to a given URL
    <T> java.util.concurrent.Future<T> patch​(java.lang.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
    <T> java.util.concurrent.Future<T> post​(java.lang.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
    <T> java.util.concurrent.Future<T> put​(java.lang.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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TAG

      protected static final java.lang.String TAG
  • Constructor Details

  • Method Details

    • get

      public <T> java.util.concurrent.Future<T> get​(java.lang.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> java.util.concurrent.Future<T> put​(java.lang.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> java.util.concurrent.Future<T> post​(java.lang.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> java.util.concurrent.Future<T> patch​(java.lang.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> java.util.concurrent.Future<T> del​(java.lang.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> java.util.concurrent.Future<T> exec​(java.lang.String path, java.lang.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 java.lang.Exception
      Specified by:
      close in interface java.lang.AutoCloseable
      Throws:
      java.lang.Exception
    • httpExecute

      public <T> java.util.concurrent.Future<T> httpExecute​(java.net.URL url, java.lang.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> java.util.concurrent.Future<T> ablyHttpExecuteWithFallback​(java.lang.String path, java.lang.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> java.util.concurrent.Future<T> ablyHttpExecuteWithRetry​(java.lang.String host, java.lang.String path, java.lang.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​(java.lang.Runnable runnable)
      Adds a Runnable to the Executor used by this scheduler instance.
      Parameters:
      runnable - The code to be executed.