• 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: Mysterious EditingContext Swap
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious EditingContext Swap


  • Subject: Re: Mysterious EditingContext Swap
  • From: Fabrice Pipart <email@hidden>
  • Date: Fri, 4 Aug 2006 17:32:27 +0200


On Aug 4, 2006, at 4:44 PM, Jerry W. Walker wrote:

Hi, Fabrice,

I did lock the child EC in the whole book method :-(
I also tried locking the childEc everywhere it was called

Though I don't think my problem is related to locks, I think its time to give a look to that MultiECLockManager class
Where did I put my Practical WebObjects book ? ;-)

So where can that problem come from ??

The EOEditingContext is referenced in lots of ways that are not particularly visible or intuitive. The basic rule seems to be, if you're interacting with an EO, then that EO's editing context better be locked whether you're directly referencing the editing context or not.

It is NOT SUFFICIENT to lock the editing context only when it is called. It is also not a good idea to lock/unlock the editing context in a component's awake and sleep methods, because it is possible that awake will be called more often than sleep.

MultiECLockManager was created to make locking multiple user created editing contexts easy. Once it's set up, it's nearly as easy as using the Session's defaultEditingContext. Basically, all you do (after setting it up) is a two step process:

  EOEditingContext myEC = new EOEditingContext();
  ((Session)session()).lockManager().registerEditingContext(ec);

That's it!  Now you're safe. The MultiECLockManager locks all your registered editing contexts in the Session's awake() method and unlocks them in the Session's sleep() method.

Anything less than this when using editing contexts that you created is generally begging for deadlock problems.

Setting up MultiECLockManager is a bit harder, but is not overly difficult and is well documented in the downloaded package.

I can provide you with notes if you download it and it still doesn't make sense.

If that doesn't do the job, I'm always open to a (full expenses paid) consulting trip to Monaco to give you a hand. :-)

Regards,
Jerry

OK
So now it is clear that I HAVE TO (not should) give a look to that MultiECLockManager I heard of many times before.
Thanks a lot for the clear answer !

I really think this mailing list is the best part of WebObjects
Thanks to all of you that read this email !

Jerry I ll come back to you if I really don't understand something !
Concerning the trip to Monaco I ll ask my boss first ;-)

I will keep you updated if MultiECLockManager solves my problem (I will implement it Monday)


Fabrice

www.easyshadow.com

International Corporate Consulting
Palais de la Scala
1 avenue Henri Dunant
Suite 1155
MC - 98000 Monaco

Skype: fabrice.pipart
Tel.  +377 97 98 21 04 (direct)
Fax. +377 97 70 88 07



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Mysterious EditingContext Swap
      • From: "Jerry W. Walker" <email@hidden>
References: 
 >Mysterious EditingContext Swap (From: Owen McKerrow <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Ken Anderson <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Owen McKerrow <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Chuck Hill <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Fabrice Pipart <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: "Jerry W. Walker" <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: Fabrice Pipart <email@hidden>)
 >Re: Mysterious EditingContext Swap (From: "Jerry W. Walker" <email@hidden>)

  • Prev by Date: Re: Event update ; notice
  • Next by Date: Re: Event update ; notice
  • Previous by thread: Re: Mysterious EditingContext Swap
  • Next by thread: Re: Mysterious EditingContext Swap
  • Index(es):
    • Date
    • Thread