Interface IAudioSendSystem

  • All Known Implementing Classes:
    DefaultSendSystem

    public interface IAudioSendSystem
    Interface that acts as a UDP audio packet sending loop.
    This interface is provided so that developers can provide their own implementation for different management of thread pools, process usage, and even for forwarding to native binaries implemented in other languages like C to avoid problems with JVM GC StopTheWorld events.
    JDA, by default, uses DefaultSendSystem for its UDP audio packet sending loop.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void setContextMap​(java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.String> contextMap)
      Called with the internal JDA MDC 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 to Thread.start(), and after a call to this method JDA assumes that the instance will be sending UDP audio packets in a loop.
    • Method Detail

      • start

        void start()
        This represents the start of the loop, similar to Thread.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.

      • shutdown

        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.

        Note: This method can be called at any time after instance creation (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.

      • setContextMap

        default void setContextMap​(@CheckForNull
                                   java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.String> contextMap)
        Called with the internal JDA MDC context map.
        This is guaranteed to be called before start().
        Parameters:
        contextMap - The JDA internal MDC context map, or null if disabled