Kanzi Framework  3.9.0
Java API
ResourceManager.LoadTask Interface Reference

Load task allows implementing custom asynchronous resource loading. More...

Public Member Functions

void finishFunction (ResourceManager resourceManager)
 The part of the loading that the main thread executes. More...
 
Resource getResult ()
 Returns the created resource. More...
 
void loadFunction (ResourceManager resourceManager)
 You can override this function to define the part of the resource loading task that a worker thread executes. More...
 

Detailed Description

Load task allows implementing custom asynchronous resource loading.

A load task is split into an optional LoadTask#loadFunction and mandatory LoadTask#finishFunction. Kanzi can execute the LoadTask#loadFunction in a background worker thread, instead of the main thread. For this reason, perform here only thread-independent work. Kanzi calls the LoadTask#loadFunction in the main thread. The load task execution happens in this order:

Member Function Documentation

◆ finishFunction()

void finishFunction ( ResourceManager  resourceManager)

The part of the loading that the main thread executes.

The function creates and stores a new resource that LoadTask#getResult() returns.

Parameters
resourceManagerThe resource manager.

◆ getResult()

Resource getResult ( )

Returns the created resource.

Returns
The created resource.

◆ loadFunction()

void loadFunction ( ResourceManager  resourceManager)

You can override this function to define the part of the resource loading task that a worker thread executes.

You cannot access any shared data inside the function.

Parameters
resourceManagerThe resource manager.