When the
JViews TGO
application context is created (using the method
IltSystem), many predefined resources are
initialized, such as alarm states and default values for
severities. Other resources such as the different predefined
object types are initialized on an as needed basis, when they
are first referenced by the application. This process takes
time and can slow down your application display time, for
example, when you try to display a large number of different
predefined nodes for the first time.
You can prevent such slowdowns by warming up TGO with an
extended context initialization that is carried out on a
background thread by the
IltSystemInitializer utility class. This
is useful for applications that perform time consuming tasks
during startup and/or initialization (such as establishing
remote connections, waiting for user authentication, and so
on).
The
IltSystemInitializer
class creates the TGO application context (by internally
invoking the
IltSystem.Init
method) extending the initialization to some resources usually
lazily initialized by the rendering of predefined objects. This
is done on a separate thread, concurrently with the time
consuming part of your application initialization.
The following example illustrates the
process:
Before starting a routine that is time
consuming, start the TGO initialization:
// Start initialization on a worker thread
IltSystemInitializer.Init("my/deployment/file.xml");
When you are ready to start your UI,
check for correct TGO initialization and continue:
// Wait for TGO initialization
// This is a blocking method!
IltSystemInitializer.WaitInitialization();
// You can check for initialization errors
Throwable error = IlpSystemInitializer.GetError());
// The context is already initialized
// There is no need to invoke IltSystem.Init()
_context = IltSystem.GetDefaultContext();
_tree = new IlpTree(_context);
Note that this technique is useful when the
IltSystemInitializer method executes in
parallel with a time consuming task.