Object DispatcherProvider

  • All Implemented Interfaces:

    
    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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

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

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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 CoroutineDispatcher getImmediate()
      final CoroutineDispatcher getIO() Represents the IO coroutine dispatcher, which is usually tied to background work.
      • Methods inherited from class java.lang.Object

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

    • 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.

      • getIO

         final CoroutineDispatcher getIO()

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