How to run tasks in background (Creo Object Toolkit - Java)?
We are working on building a Creo application using Object Toolkit Java.
One usecase of our application is to execute tasks in background (such as authentication flow, upload opened model) while displaying progress (using animated gifs) on the custom UI created using Creo UI editor.
As per our observation, whenever we start a task in background by creating a new Thread in Java, it blocks the currently open UI dialog i.e the UI dialog completely freezes and doesn't display anything.
The result is same for all modality types for a dialog - MODAL, MODELESS and WORKING.
Sample code snippet:
uifcComponent.CreateDialog(UPLOAD_DIALOG, UPLOAD_DIALOG);
uifcDialog.DialogFind(UPLOAD_DIALOG, UPLOAD_DIALOG).SetModality(DialogStyle.DIALOG_STYLE_WORKING);
uifcComponent.ActivateDialog(UPLOAD_DIALOG);
Thread backgroundThread = new Thread(() -> {
// Background tasks
// Destroy dialog once background task is complete
uifcComponent.DestroyDialog(UPLOAD_DIALOG, UPLOAD_DIALOG);
}, "thread_name");
backgroundThread.setDaemon(true);
backgroundThread.start();
cc:

