I have a popup showing some statuses. This popup is opened from a screen where there is a run button
In popup in aftershow handler i added a while loop with a condition to repeat until the run action is completed and inside i wait 5 seconds each time. Code attached below. But what happens is the popup is shown only after the while loop exits.
I can see the REFRESHING logs but popup is not shown.
Is there any workaround for this
public void onAfterShow(AfterShowEvent event) {
BatchStatus wholeBatchStatus;
BatchStatusEnum wholeBatchStatusEnum = BatchStatusEnum.RUNNING;
while(BatchStatusEnum.RUNNING.equals(wholeBatchStatusEnum)) {
try {
System.out.println("REFRESHING" + new Date());
Thread.sleep(5000);
batchStatusesDl.load();
} catch (Exception e) {
}
wholeBatchStatus = dataManager.load(BatchStatus.class)
.query("select e from BatchStatus e where e.source is null")
.one();
wholeBatchStatusEnum = wholeBatchStatus.getStatus();
}
}