Class GenericAsyncRendererFactory

java.lang.Object
org.jtrim2.ui.concurrent.query.GenericAsyncRendererFactory
All Implemented Interfaces:
AsyncRendererFactory

public final class GenericAsyncRendererFactory extends Object implements AsyncRendererFactory
An implementation of AsyncRendererFactory which executes rendering tasks in a TaskExecutor specified at construction time. That is, the DataRenderer.startRendering(CancellationToken), DataRenderer.render(CancellationToken, DataType) and the DataRenderer.finishRendering(CancellationToken, AsyncReport) methods will be executed in the context of the TaskExecutor.

As required by the AsyncRendererFactory interface, AsyncRenderer created by GenericAsyncRendererFactory are independent in a way that no two AsyncRenderer instances will overwrite each other's rendering requests.

Thread safety

Instances of this class are safe to be accessed from multiple threads concurrently.

Synchronization transparency

Instances of this class are not synchronization transparent.
See Also:
  • Constructor Details

    • GenericAsyncRendererFactory

      public GenericAsyncRendererFactory(TaskExecutor executor)
      Creates a new GenericAsyncRendererFactory which will execute rendering tasks on the specified TaskExecutor.
      Parameters:
      executor - the TaskExecutor used to execute the submitted rendering tasks. This argument cannot be null.
      Throws:
      NullPointerException - thrown if the specified executor is null
  • Method Details

    • createRenderer

      public AsyncRenderer createRenderer()
      Creates an AsyncRenderer which is able to render a component.

      Note that it is not strictly required that this method return a new unique instance but to avoid independent AsyncRenderer overwriting each other's rendering requests, it is usually necessary.

      Specified by:
      createRenderer in interface AsyncRendererFactory
      Returns:
      an AsyncRenderer which is able to render a component. This method never returns null.