Class DefaultSendSystem
- java.lang.Object
-
- net.dv8tion.jda.api.audio.factory.DefaultSendSystem
-
- All Implemented Interfaces:
IAudioSendSystem
public class DefaultSendSystem extends java.lang.Object implements IAudioSendSystem
The default implementation of theIAudioSendSystem
.
This implementation uses a Java thread, named based on:IPacketProvider.getIdentifier()
+ " Sending Thread".
-
-
Constructor Summary
Constructors Constructor Description DefaultSendSystem(IPacketProvider packetProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setContextMap(java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> contextMap)
Called with the internal JDAMDC
context map.void
shutdown()
This represents the destruction of this instance and should be used to perform all necessary cleanup and shutdown operations needed to free resources.void
start()
This represents the start of the loop, similar toThread.start()
, and after a call to this method JDA assumes that the instance will be sending UDP audio packets in a loop.
-
-
-
Constructor Detail
-
DefaultSendSystem
public DefaultSendSystem(IPacketProvider packetProvider)
-
-
Method Detail
-
setContextMap
public void setContextMap(@CheckForNull java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.String> contextMap)
Description copied from interface:IAudioSendSystem
Called with the internal JDAMDC
context map.
This is guaranteed to be called beforeIAudioSendSystem.start()
.- Specified by:
setContextMap
in interfaceIAudioSendSystem
- Parameters:
contextMap
- The JDA internal MDC context map, ornull
if disabled
-
start
public void start()
Description copied from interface:IAudioSendSystem
This represents the start of the loop, similar toThread.start()
, and after a call to this method JDA assumes that the instance will be sending UDP audio packets in a loop.Note: The packet sending loop should NOT be started on the current thread. I.E: This method should not block forever, in the same way that
Thread.start()
does not. Just like in Thread, the running action of this system should be implemented asynchronously.- Specified by:
start
in interfaceIAudioSendSystem
-
shutdown
public void shutdown()
Description copied from interface:IAudioSendSystem
This represents the destruction of this instance and should be used to perform all necessary cleanup and shutdown operations needed to free resources.Note: This method can be called at any time after instance creation (
IAudioSendSystem.start()
may not yet have been called), and it is possible that this method could be called more than once due to edge-case shutdown conditions.- Specified by:
shutdown
in interfaceIAudioSendSystem
-
-