Package io.ably.lib.http
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.AutoCloseableHttpScheduler 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.StringTAG
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpScheduler(HttpCore httpCore, CloseableExecutor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods 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 necessaryvoidclose()<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 fallbacksvoidexecute(java.lang.Runnable runnable)Adds aRunnableto theExecutorused 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
-
-
-
Constructor Detail
-
HttpScheduler
protected HttpScheduler(HttpCore httpCore, CloseableExecutor executor)
-
-
Method Detail
-
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:
closein interfacejava.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 aRunnableto theExecutorused by this scheduler instance.- Parameters:
runnable- The code to be executed.
-
-