Re: Synchronized Editing Context for Locking/Unlocking
Re: Synchronized Editing Context for Locking/Unlocking
- Subject: Re: Synchronized Editing Context for Locking/Unlocking
- From: Ken Anderson <email@hidden>
- Date: Fri, 3 Sep 2010 08:18:47 -0400
A lot.
In usage 2, the editing context is not locked, and everything that goes along with it. You're just using a java construct to provide exclusive use of the editing context to your thread, but there are many other things that go along with an editing context being locked that are not happening.
Don't use #2.
Ken
On Sep 3, 2010, at 7:59 AM, Farrukh Ijaz wrote:
> Hi,
>
> What is the difference between the two? I noticed both work almost the same way.
>
> Usage 1:
>
> try {
> editingContext().lock();
> // Do your stuff
> } finally {
> editingContext().unlock();
> }
>
> Usage 2:
>
> synchronized(editingContext()) {
> // Do your stuff
> }
>
> Thanks,
>
> Farrukh _______________________________________________
> 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