Hello,
I am currently trying to build a ‘Job Monitoring’ View using Quartz.
But I am experiencing some problems.
My first approach was simple: Just let the JobsView implement JobListener and add it to the scheduler.
(scheduler.getListenerManager().addJobListener(this)
This is not possible, since the newly added instance overwrites the old one.
Now I tried it with a GlobalListener, defined in the quartz.properties and Broadcast the event to all listeners and then push the changes to the view using the EventBus.
This wont work either, because the BroadcastListener can’t get the CurrentUI.
public static DashboardEventBus getDashboardEventbus() {
return ((DashboardUI) getCurrent()).dashboardEventbus;
}
returns Null and causes a NullPointerException.
To clarify it a bit:
class DashboardUI extends UI implements Broadcaster.BroadcastListener {
init() ....
@Override
public void broadcastTest(String msg) {
DashboardEventBus.post(new DashboardEvent.Test(msg)); --- NullPointer happens here
}
@Subscribe
public void receiveTest(Final DashboardEvent.Test event) {
....
}
}
public class SchedulerGlobalListener implements JobListener {
//Gets initialized by Quartz.properties (org.quartz.jobListener.SchedulerGlobalListener.class = ... )
@Overwrite
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
Broadcaster.broadcastTest("Job was executed ");
}
}
I hope my post isn’t gibberish to you guys.
Thanks for any tips and pointers.