Re: Object registered within another EditingContext
Re: Object registered within another EditingContext
- Subject: Re: Object registered within another EditingContext
- From: Paul Hoadley <email@hidden>
- Date: Fri, 13 Oct 2017 09:12:45 +1030
Hi André,
On 13 Oct 2017, at 04:53, André Rothe <email@hidden> wrote:
> Then I have created a thread with a new EditingContext to insert a lot of
> detail records, which have a reference to the first inserted record.
You need to take some additional care when working in a background thread.
1. Don’t pass an existing EOEditingContext into a background thread, create a
new one—you’re doing this.
2. Don’t pass existing EOs into a background thread, pass in the object’s
EOGlobalID, and then get the object in the thread using that ID.
* ERXEOControlUtilities.convertEOtoGID()
* ERXEOControlUtilities.convertGIDtoEO()
3. There are some classes in er.extensions.concurrency that you might find
helpful, though I’ve never used them. If you just want to use regular Java
concurrency features, remember to handle EC locking/unlocking yourself:
ec.lock();
try {
// ...
} finally {
ec.unlock();
}
(On the main thread, Wonder handles locking/unlocking for you.)
--
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/
_______________________________________________
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