Interface UiExecutorProvider


public interface UiExecutorProvider
Defines a factory for executors scheduling events on the UI thread of the underlying UI framework (such as Swing or Java FX).

Thread safety

The methods of this interface are expected to be safely accessible from multiple threads concurrently.

Synchronization transparency

The methods of this interface are required to be synchronization transparent.
  • Method Summary

    Modifier and Type
    Method
    Description
    getSimpleExecutor(boolean alwaysExecuteLater)
    Returns a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework.
    getStrictExecutor(boolean alwaysExecuteLater)
    Returns a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework.
  • Method Details

    • getSimpleExecutor

      TaskExecutor getSimpleExecutor(boolean alwaysExecuteLater)
      Returns a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework. The returned executor does not necessarily executes tasks in the same order as the tasks were submitted. In case tasks needed to be executed in the same order as they were submitted to the executor: Use the getStrictExecutor(boolean) method.
      Parameters:
      alwaysExecuteLater - if this argument is true, submitted tasks are never executed synchronously on the calling thread (i.e.: if the calling thread is the UI thread, the framework must execute the scheduled task later). In case this argument is false, tasks submitted from an UI thread will be executed immediately on the calling thread.
      Returns:
      a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework. This method never returns null.
    • getStrictExecutor

      TaskExecutor getStrictExecutor(boolean alwaysExecuteLater)
      Returns a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework. The returned executor executes tasks in the same order as the tasks were submitted. If you don't need to execute them in the same order, consider using the getSimpleExecutor(boolean) method.

      The returned executor is more efficient than an instance of SwingTaskExecutor.

      Parameters:
      alwaysExecuteLater - if this argument is true, submitted tasks are never executed synchronously on the calling thread (i.e.: if the calling thread is the UI thread, the framework must execute the scheduled task later). In case this argument is false, tasks submitted from the UI thread will be executed immediately on the calling thread (this may not always possible to execute tasks in the order they were submitted).
      Returns:
      a TaskExecutor which executes tasks submitted to them on the UI thread of the associated UI framework. This method never returns null.