• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Recurring willUpdate Notifications Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recurring willUpdate Notifications Problem


  • Subject: Re: Recurring willUpdate Notifications Problem
  • From: Samuel Pelletier <email@hidden>
  • Date: Wed, 12 Aug 2015 09:17:16 -0400

Hi Henrique,

I think there is a cycle risk if we call recursively but this can be eliminated by imposing a restriction to call only a single time a notification on a particular object.

The handling seems to be done in ERXEnterpriseObject, lines 72-74, I suggest somethings like this to handle the cascading of these notification :

NSMutableSet notifedInsertedObjects = new NSMutableSet
NSMutableSet notifedIUpdatedObjects = new NSMutableSet
NSMutableSet notifedIDeletedObjects = new NSMutableSet
boolean notificationCompleted = false;
while (notificationCompleted == false) {
	NSSet newInsertedObjects = new NSSet(ec.insertedObjects())setBySubtractingSet(notifedInsertedObjects);
	... for updated and deleted objects

	if (newInsertedObjects.isEmpty()  && newUpdatedObjects.isEmpty() && newDeletedObjects.isEmpty() {
		notificationCompleted = true;
	}
	ERXEnterpriseObject.WillInsertProcessor.perform(ec, newInsertedObjects);
	notifedInsertedObjects.addAll(newInsertedObjects);

	... for updated and deleted objects
}

The didXXX does not have this problem since the save is done and the objects are all known.



> Le 2015-08-11 à 16:22, Henrique Prange <email@hidden> a écrit :
>
> Hey guys,
>
> I’ve been using Wonder’s augmented transaction methods in combination with notifications to encourage a loosely coupled design. Over time, I've been increasingly applying this kind of solution on my systems. Now, I'm facing a problem when expecting to produce notifications for recurring EO changes. Basically, I expect the invocation of the willUpdate method on a second EO changed during the willUpdate phase of a former EO. However, in that scenario, the second EO willUpdate method is never invoked.
>
> I've seen that the CooperatingEditingContext described in the Practical WebObjects book does exactly what I want. So, is there a reason to not support notifications for recurring changes (i.e. avoid notification cycles)? Is the current behavior expected? Or is it a misbehavior?
>
> Cheers,
>
> Henrique
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Recurring willUpdate Notifications Problem
      • From: Henrique Prange <email@hidden>
References: 
 >Recurring willUpdate Notifications Problem (From: Henrique Prange <email@hidden>)

  • Prev by Date: Recurring willUpdate Notifications Problem
  • Next by Date: Re: Gradle and Eclipse
  • Previous by thread: Recurring willUpdate Notifications Problem
  • Next by thread: Re: Recurring willUpdate Notifications Problem
  • Index(es):
    • Date
    • Thread