Package discord4j.voice
Class VoiceReactorResources
- java.lang.Object
-
- discord4j.common.ReactorResources
-
- discord4j.voice.VoiceReactorResources
-
public class VoiceReactorResources extends ReactorResources
Provides an extra level of configuration forReactorResources, tailored for the Voice Gateway operations.Allows customizing the
Schedulerused to send and receive voice packets and also theUdpClienttemplate for establishing UDP connections.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVoiceReactorResources.BuilderBuilder forVoiceReactorResources.
-
Field Summary
-
Fields inherited from class discord4j.common.ReactorResources
DEFAULT_BLOCKING_TASK_SCHEDULER, DEFAULT_HTTP_CLIENT, DEFAULT_TIMER_TASK_SCHEDULER
-
-
Constructor Summary
Constructors Modifier Constructor Description VoiceReactorResources(ReactorResources parent)Create Voice Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.VoiceReactorResources(ReactorResources parent, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler)Create Voice Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.protectedVoiceReactorResources(VoiceReactorResources.Builder builder)VoiceReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler)Create Voice Gateway resources allowing full customization of its properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VoiceReactorResources.Builderbuilder()Returns a new builder to createVoiceReactorResources.static VoiceReactorResources.Builderbuilder(ReactorResources reactorResources)Returns a new builder to createVoiceReactorResourcesfrom a pre-configuredReactorResources, copying its settings.static VoiceReactorResourcescreate()Create a default set of Voice Gateway resources.SchedulergetReceiveTaskScheduler()Returns theSchedulerused to run the voice receive loop.SchedulergetSendTaskScheduler()Returns theSchedulerused to run the voice send loop.UdpClientgetUdpClient()Returns the UDP client used to create voice protocol connections.VoiceReactorResources.Buildermutate()Returns a builder to create a newVoiceReactorResourceswith settings copied from the currentVoiceReactorResources.-
Methods inherited from class discord4j.common.ReactorResources
getBlockingTaskScheduler, getHttpClient, getTimerTaskScheduler, newHttpClient, newHttpClient
-
-
-
-
Constructor Detail
-
VoiceReactorResources
public VoiceReactorResources(ReactorResources parent)
Create Voice Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.- Parameters:
parent- the resources instance to get properties from
-
VoiceReactorResources
public VoiceReactorResources(ReactorResources parent, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler)
Create Voice Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.- Parameters:
parent- the resources instance to get properties fromudpClient- the UDP client used to create voice protocol connectionssendTaskScheduler- the scheduler used to run the voice send loopreceiveTaskScheduler- the scheduler used to run the voice receive loop
-
VoiceReactorResources
public VoiceReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, UdpClient udpClient, Scheduler sendTaskScheduler, Scheduler receiveTaskScheduler)
Create Voice 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_SCHEDULERudpClient- the UDP client used to create voice protocol connectionssendTaskScheduler- the scheduler used to run the voice send loopreceiveTaskScheduler- the scheduler used to run the voice receive loop
-
VoiceReactorResources
protected VoiceReactorResources(VoiceReactorResources.Builder builder)
-
-
Method Detail
-
create
public static VoiceReactorResources create()
Create a default set of Voice Gateway resources.- Returns:
- a new
VoiceReactorResourcesusing all default properties
-
builder
public static VoiceReactorResources.Builder builder()
Returns a new builder to createVoiceReactorResources.- Returns:
- a builder to create
VoiceReactorResources
-
builder
public static VoiceReactorResources.Builder builder(ReactorResources reactorResources)
Returns a new builder to createVoiceReactorResourcesfrom a pre-configuredReactorResources, copying its settings.- Returns:
- a builder to create
VoiceReactorResourceswith settings copied from parent resources
-
mutate
public VoiceReactorResources.Builder mutate()
Returns a builder to create a newVoiceReactorResourceswith settings copied from the currentVoiceReactorResources.- Returns:
- a builder based off this instance properties
-
getUdpClient
public UdpClient getUdpClient()
Returns the UDP client used to create voice protocol connections.- Returns:
- the UDP client
-
getSendTaskScheduler
public Scheduler getSendTaskScheduler()
Returns theSchedulerused to run the voice send loop.- Returns:
- the send scheduler
-
-