Re: [OS-JIRA] Commented: (CAY-308) ObjectStore.processUpdatedSnapshots race condition with ObjectStore.resolveHollow

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Apr 27 2005 - 10:36:20 EDT

  • Next message: Mike Kienenberger: "Patching 1.1"

    Andrus Adamchik wrote:
    > While the problem is there, I suspect you run into it so often because of
    your custom event dispatch mechanism.
    > ObjectStore should discard its own events:
    >
    > if (event.getPostedBy() != this.dataRowCache
    > || event.getSource() == this) {
    > return;
    > }
    >
    > so normally only updates from the other ObjectStores can trip over this
    > (unless there is a bug in dispatch mechansim causing it to loop
    somehow?)...

    Yes, there's a situation here I'd like to avoid, but I don't understand how
    to do it.

    What happens is that DataContext A commits a change and broadcasts a
    SnapshotEvent.

    The LocalEventBridge for DataContext B picks up the SnapshotEvent, and
    reposts it as a SnapshotEvent with itself as a source so that DataContextB's
    DataRowStore will receive it.

    DataRowStore B handles the SnapshotEvent, then sends out its own
    SnapshotEvent event with itself as the posted-by, leaving the source as the
    LocalEventBridge. So now there's no reference to the original
    source/poster.

    This event is then received by ObjectStore A's snapshotsChanged(), but it's
    no longer recognizable as being originally from itself or its DataRowStore.

    Worse, if there's N DataContexts, then ObjectStore A will receive N-1
    snapshotChanged() messages for every SnapshotEvent broadcast from
    DataContext A.

    Fortunately, this app is low-traffic, so there's generally not a large
    number of outstanding DataContexts participating in this SnapShot "storm".

    Maybe the solution is to add another field to SnapshotEvent in addition to
    posted-by and source. Or maybe DataRowStore.processRemoteEvent() should
    only accept events posted-by the remoteNotificationsHandler rather than with
    a source of the remoteNotificationsHandler, so that the source can be
    preserved. Or maybe there should be an option so that processRemoteEvent()
    doesn't rebroadcast an event?

            // how it works now
        DataRowStore.processRemoteEvent(SnapshotEvent event) {
            if (event.getPostedBy() == this
                    || event.getSource() != remoteNotificationsHandler) {
                return;
            }

    On a related topic -- there's no way for an EventBridge to know what
    DataRowStore created it.



    This archive was generated by hypermail 2.0.0 : Wed Apr 27 2005 - 10:34:39 EDT