Thread monitoring

The IlvThreadedActivityMonitorProperty class is a named property used to attach a IlvThreadedActivityMonitor to an IlvManager IlvManager .
This threaded monitor is a centralized object with which threads should register their activities. The activities, that is, tasks, must also notify this controller of their progress.
All activity listeners registered with this controller are notified in turn of any activity progress. The IlvThreadedActivityMonitorPanel is one such important listener. This bean provides the user with feedback on activities that are currently running, see Using the GUI beans.
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at <installdir> /jviews-maps810/samples/mapbuilder/index.html.

Accessing the threaded activity monitor

You can access the threaded activity monitor by calling:
IlvThreadedActivityMonitor mon = 
IlvThreadedActivityMonitorProperty.GetThreadedActivityMonitor(manager);

Providing threaded activity information

It is the responsibility of each thread to register, update and unregister their activities to provide the user with correct information on the background tasks that are running:
mon.updateActivityProgress(activityID,10,"doing something long");
... do something long that takes 10% of total time...
mon.updateActivityProgress(activityID,20,"doing another thing");
...
Setting the activity progress to 100% or unregistering the activity removes it from the list currently managed by the monitor.

Registering objects as listeners

You can also register your own objects as listeners to changes in the activity monitor with lines of code such as:
mon.addActivityListener(new IlvThreadedActivityMonitor.ActivityListener() {
  public void activityChanged(ActivityEvent e) {
if(e.getEventType() == 
IlvThreadedActivityMonitor.ActivityEvent.ACTIVITY_REMOVED) {
 ... an activity just ended, do something.
  }
});