Package com.flagsmith.threads
Class RequestProcessor
java.lang.Object
com.flagsmith.threads.RequestProcessor
public class RequestProcessor extends Object
-
Constructor Summary
Constructors Constructor Description RequestProcessor(okhttp3.OkHttpClient client, FlagsmithLogger logger)RequestProcessor(okhttp3.OkHttpClient client, FlagsmithLogger logger, Retry retries)Instantiate with client, logger and retries. -
Method Summary
Modifier and Type Method Description voidclose()<T> Future<T>executeAsync(okhttp3.Request request, com.fasterxml.jackson.core.type.TypeReference<T> clazz, Boolean doThrow)Execute the request in async mode.<T> Future<T>executeAsync(okhttp3.Request request, com.fasterxml.jackson.core.type.TypeReference<T> clazz, Boolean doThrow, Retry retries)Execute the response in async mode.Future<com.fasterxml.jackson.databind.JsonNode>executeAsync(okhttp3.Request request, Boolean doThrow)Execute the response in async mode and do not unmarshall.
-
Constructor Details
-
RequestProcessor
-
RequestProcessor
Instantiate with client, logger and retries.- Parameters:
client- client instancelogger- logger instanceretries- retries
-
-
Method Details
-
executeAsync
public <T> Future<T> executeAsync(okhttp3.Request request, com.fasterxml.jackson.core.type.TypeReference<T> clazz, Boolean doThrow)Execute the request in async mode.- Type Parameters:
T- Type inference for the response- Parameters:
request- request to invokeclazz- class type of responsedoThrow- should throw Exception (boolean)
-
executeAsync
public Future<com.fasterxml.jackson.databind.JsonNode> executeAsync(okhttp3.Request request, Boolean doThrow)Execute the response in async mode and do not unmarshall.- Parameters:
request- request to invokedoThrow- whether to throw exception or not
-
executeAsync
public <T> Future<T> executeAsync(okhttp3.Request request, com.fasterxml.jackson.core.type.TypeReference<T> clazz, Boolean doThrow, Retry retries)Execute the response in async mode.- Type Parameters:
T- Type inference for the response- Parameters:
request- Request objectclazz- class type of responsedoThrow- should throw Exceptionretries- no of retries before failing
-
close
public void close()
-