Package 

Object DispatcherProvider


  • 
    public class DispatcherProvider
    
                        

    Coroutine dispatchers used internally by Stream libraries. Should always be used instead of directly using Dispatchers or creating new dispatchers.

    Can be modified using set and reset for testing purposes.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private CoroutineDispatcher Main
      private final CoroutineDispatcher Immediate
      private CoroutineDispatcher IO
      public final static DispatcherProvider INSTANCE
    • Method Summary

      Modifier and Type Method Description
      final Unit set(CoroutineDispatcher mainDispatcher, CoroutineDispatcher ioDispatcher) Overrides the main (UI thread) and IO dispatcher.
      final Unit reset() Resets the dispatchers to their default values.
      final CoroutineDispatcher getMain() Represents the Main coroutine dispatcher, tied to the UI thread.
      final Unit setMain(CoroutineDispatcher Main)
      final CoroutineDispatcher getImmediate()
      final CoroutineDispatcher getIO() Represents the IO coroutine dispatcher, which is usually tied to background work.
      final Unit setIO(CoroutineDispatcher IO)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • set

         final Unit set(CoroutineDispatcher mainDispatcher, CoroutineDispatcher ioDispatcher)

        Overrides the main (UI thread) and IO dispatcher. For testing purposes only.

      • reset

         final Unit reset()

        Resets the dispatchers to their default values. For testing purposes only.

      • getMain

         final CoroutineDispatcher getMain()

        Represents the Main coroutine dispatcher, tied to the UI thread.

      • setMain

         final Unit setMain(CoroutineDispatcher Main)
      • getIO

         final CoroutineDispatcher getIO()

        Represents the IO coroutine dispatcher, which is usually tied to background work.

      • setIO

         final Unit setIO(CoroutineDispatcher IO)