public class ReactorResources extends Object
HttpClient and Scheduler instances that can be customized
and reused across the application.
Allow a user to externally manage the connection pool through a custom ConnectionProvider, and custom
event loop threads using a LoopResources.
| Modifier and Type | Class and Description |
|---|---|
static class |
ReactorResources.Builder |
| Modifier and Type | Field and Description |
|---|---|
static Supplier<Scheduler> |
DEFAULT_BLOCKING_TASK_SCHEDULER |
static Supplier<HttpClient> |
DEFAULT_HTTP_CLIENT |
static Supplier<Scheduler> |
DEFAULT_TIMER_TASK_SCHEDULER |
| Modifier | Constructor and Description |
|---|---|
|
ReactorResources()
Create with a default
HttpClient and Schedulers for timed and blocking tasks. |
|
ReactorResources(HttpClient httpClient,
Scheduler timerTaskScheduler,
Scheduler blockingTaskScheduler)
Create with a pre-configured
HttpClient and Schedulers for timed and blocking tasks. |
protected |
ReactorResources(ReactorResources.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
static ReactorResources.Builder |
builder() |
static ReactorResources |
create() |
Scheduler |
getBlockingTaskScheduler()
Get the
Scheduler configured by this provider to be used in blocking tasks. |
HttpClient |
getHttpClient()
Get the
HttpClient configured by this provider. |
Scheduler |
getTimerTaskScheduler()
Get the
Scheduler configured by this provider to be used in timed tasks. |
static HttpClient |
newHttpClient(ConnectionProvider provider,
LoopResources resources)
Create a Reactor Netty
HttpClient using the given connection pool and event loop threads. |
public static final Supplier<HttpClient> DEFAULT_HTTP_CLIENT
public ReactorResources()
HttpClient and Schedulers for timed and blocking tasks.public ReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler)
HttpClient and Schedulers for timed and blocking tasks.httpClient - the underlying HttpClient to usetimerTaskScheduler - the time-capable Scheduler to useblockingTaskScheduler - the Scheduler to use for potentially blocking tasksprotected ReactorResources(ReactorResources.Builder builder)
public static ReactorResources create()
public static ReactorResources.Builder builder()
public HttpClient getHttpClient()
HttpClient configured by this provider.public Scheduler getTimerTaskScheduler()
Scheduler configured by this provider to be used in timed tasks.Schedulerpublic Scheduler getBlockingTaskScheduler()
Scheduler configured by this provider to be used in blocking tasks.Schedulerpublic static HttpClient newHttpClient(ConnectionProvider provider, LoopResources resources)
HttpClient using the given connection pool and event loop threads.
Use this in case you want dedicated resources for a particular client or clients instead of the global
default. Requires externally disposing of the given parameters on
application shutdown, through ConnectionProvider.dispose() and
LoopResources.dispose().
provider - the connection pool provider to useresources - the set of event loop threads to useHttpClient configured with custom resources