Bug #307
openpackage event handler to improve resultset refresh performance
0%
Description
Performance on Morpho is pretty poor, partly because it spends so much time
querying Metacat and the local files in order to keep the main resultset display
refreshed. We could substantially improve things by caching the resultset
(which we already have in memory) and making updates to it rather than
re-querying Metacat (or locally). Whenever the user makes a change to any file
in a package, it results in one of three events: PACKAGE-INSERTED,
PACKAGE-UPDATED, or PACKAGE-DELETED. For each of these events, the change can
occur on the local data store or on the metacat store, or both.
I propose that we develop an event notification system so that any morpho
component that is interested can find out when one of these events has occurred
(which will require the component generating the event to initiate the
notification). For INSERT and UPDATE events, if the package is local, we can
look at the package on disk, extract the relevant resultset info, and delete the
old entry in the in-memory resultset, and add the new entry in the in-memory
resultset. If the changed package is only on metacat, we'll have to retrieve
the package from metacat to get the package details, and then insert into the
in-memory copy as above (which is expensive), or hopefully we can get the info
from our local cache. In the case of DELETE events, we can always just remove
the entry from the resultset.
To implement this requires creating these basic classes/methods:
In a DataPackage class (not sure which yet):
void firePackageEvent(PackageEvent pe);
called by all routines that insert, update, or delete packages
void addPackageEventListener(PackageEventListener listenrer);
called by a class that wants to register as a listener for pe's
In classes that want to listen for pe's:
void handlePackageEvent(PackageEvent pe);
called by the event handler whenever a package is changed
this method is provided by all classes that want to be notified of
package events (like the ResultSet class) and would be part of a
PackageEventListener interface that they would implement
The PackageEvent class would include attributes like:
source -- a reference to the package generating the event
identifier -- the docid of the package generating the event
eventType -- INSERT, UPDATE, DELETE, other?
This feature would allow us to keep all ResultSets up-to-date as changes are
made to packages without re-querying morpho or metacat, which should improve the
overall user-interface performance substantially.
Feedback requested.