Using the IlvThreadMonitor
IlvThreadedActivityMonitor is a class that monitors the progress of several tasks running in separate threads.
These tasks first register with this monitor through the
registerThreadedActivity method, and then notify the monitor of any progress they make by calling the
updateActivityProgress method. Eventually, a task can be removed from the list by calling
unregisterThreadedActivity method. A task that reports a progress reading of one hundred percent is automatically unregistered from the monitor.
In its turn, the monitor notifies any registered listeners of the progress being made by the monitored tasks.
Multithread Monitor shows the
IlvThreadedActivityMonitorPanel class, which is a Swing component implementing the
IlvThreadedActivityMonitor.ActivityListener interface. It displays progress bars for monitored activities.
Multithread Monitor
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at
<installdir> /jviews-maps/samples/mapbuilder/index.htmlIf you want to display the progress of your own threaded tasks on this
IlvThreadedActivityMonitorPanel, here are the basic actions you should take:
IlvManagerView view; // the main view of the application
// Get the manager of this view (provided that it was set somewhere before)
IlvManager manager = view.getManager();
// Get the activity monitor associated with this manager
IlvThreadedActivityMonitor monitor =
IlvThreadedActivityMonitorProperty.GetThreadedActivityMonitor(manager);
if (monitor != null) {
// Notify the monitor of the progress of this activity
monitor.updateActivityProgress(this,100,null);
};
For further information about this bean, see
Multithread Monitor.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.