I have a Quartz Job which checks every 30 min if there is a software update available. This i trigger in the code below. But i get a Nullpointer at UI.getCurrent(). How can i make a Notification visible, independet on which page the user is?
@Service
@DisallowConcurrentExecution
public class SystemJobCheckForUpdates extends UI implements Job {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
UI.getCurrent().access(() -> {
Notification.show("Update available");
});
}
}
The "problem" is, that the sheduler is not associated with a concrete UI instance.
You will either need to store the UI instance in a global variable or use some kind of broadcast / message bus for this.