Package discord4j.gateway
Class GatewayReactorResources
- java.lang.Object
-
- discord4j.common.ReactorResources
-
- discord4j.gateway.GatewayReactorResources
-
public class GatewayReactorResources extends ReactorResources
Provides an extra level of configuration forReactorResources, tailored for the Gateway operations.Allows customizing the
Schedulerused to send gateway payloads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGatewayReactorResources.BuilderBuilder forGatewayReactorResources.
-
Field Summary
Fields Modifier and Type Field Description static Supplier<Scheduler>DEFAULT_PAYLOAD_SENDER_SCHEDULER-
Fields inherited from class discord4j.common.ReactorResources
DEFAULT_BLOCKING_TASK_SCHEDULER, DEFAULT_HTTP_CLIENT, DEFAULT_TIMER_TASK_SCHEDULER
-
-
Constructor Summary
Constructors Modifier Constructor Description GatewayReactorResources(ReactorResources parent)Create Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.GatewayReactorResources(ReactorResources parent, Scheduler payloadSenderScheduler)Create Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.protectedGatewayReactorResources(GatewayReactorResources.Builder builder)GatewayReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, Scheduler payloadSenderScheduler)Create Gateway resources allowing full customization of its properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GatewayReactorResources.Builderbuilder()Returns a new builder to createGatewayReactorResources.static GatewayReactorResources.Builderbuilder(ReactorResources reactorResources)Returns a new builder to createGatewayReactorResourcesfrom a pre-configuredReactorResources, copying its settings.static GatewayReactorResourcescreate()Create a default set of Gateway resources.SchedulergetPayloadSenderScheduler()Get the scheduler used for sending gateway payloads.GatewayReactorResources.Buildermutate()Returns a builder to create a newGatewayReactorResourceswith settings copied from the currentGatewayReactorResources.-
Methods inherited from class discord4j.common.ReactorResources
getBlockingTaskScheduler, getHttpClient, getTimerTaskScheduler, newHttpClient, newHttpClient
-
-
-
-
Constructor Detail
-
GatewayReactorResources
public GatewayReactorResources(ReactorResources parent)
Create Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.- Parameters:
parent- the resources instance to get properties from
-
GatewayReactorResources
public GatewayReactorResources(ReactorResources parent, Scheduler payloadSenderScheduler)
Create Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.- Parameters:
parent- the resources instance to get properties frompayloadSenderScheduler- aSchedulerfor sending payloads. A default can be created fromDEFAULT_PAYLOAD_SENDER_SCHEDULER
-
GatewayReactorResources
public GatewayReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, Scheduler payloadSenderScheduler)
Create Gateway resources allowing full customization of its properties.- Parameters:
httpClient- the HTTP client to use for initiating Gateway websocket connections. A default is provided inReactorResources.DEFAULT_HTTP_CLIENTtimerTaskScheduler- the scheduler for timed tasks. A default can be created fromReactorResources.DEFAULT_TIMER_TASK_SCHEDULERblockingTaskScheduler- the scheduler for blocking tasks. A default can be created fromReactorResources.DEFAULT_BLOCKING_TASK_SCHEDULERpayloadSenderScheduler- a scheduler for sending payloads. A default can be created fromDEFAULT_PAYLOAD_SENDER_SCHEDULER
-
GatewayReactorResources
protected GatewayReactorResources(GatewayReactorResources.Builder builder)
-
-
Method Detail
-
create
public static GatewayReactorResources create()
Create a default set of Gateway resources.- Returns:
- a new
GatewayReactorResourcesusing all default properties
-
builder
public static GatewayReactorResources.Builder builder()
Returns a new builder to createGatewayReactorResources.- Returns:
- a builder to create
GatewayReactorResources
-
builder
public static GatewayReactorResources.Builder builder(ReactorResources reactorResources)
Returns a new builder to createGatewayReactorResourcesfrom a pre-configuredReactorResources, copying its settings.- Returns:
- a builder to create
GatewayReactorResourceswith settings copied from parent resources
-
mutate
public GatewayReactorResources.Builder mutate()
Returns a builder to create a newGatewayReactorResourceswith settings copied from the currentGatewayReactorResources.- Returns:
- a builder based off this instance properties
-
getPayloadSenderScheduler
public Scheduler getPayloadSenderScheduler()
Get the scheduler used for sending gateway payloads.- Returns:
- a scheduler for payload tasks
-
-