Guessing, concurrent threads, and locking. Never a good combination.
On Aug 11, 2010, at 2:35 PM, Farrukh Ijaz wrote: > I am using ERXEC with default settings. I guess it takes care of the locking > automatically. > > Sent from my iPad > > On 11-Aug-2010, at 11:58 PM, Chuck Hill <[email protected]> wrote: > >> >> On Aug 11, 2010, at 1:41 PM, Farrukh Ijaz wrote: >> >>> >>> >>> Sent from my iPad >>> >>> On 11-Aug-2010, at 7:35 PM, Chuck Hill <[email protected]> wrote: >>> >>>> >>>> On Aug 11, 2010, at 2:11 AM, Farrukh Ijaz wrote: >>>> >>>>> Hi All, >>>>> >>>>> Is it safe to invoke editingContext().saveChange() or >>>>> editingContext().revert() in a method that is used through NSSelector and >>>>> invoked by the NSNotificationCenter on postNotification()? >>>> >>>> >>>> That likely depends on which notification. >>> >>> Okay, here is the real scenario. I have developed a Workflow Engine which >>> is capable to run multiple workflows in parallel in their individual >>> threads. Each workflow has methods as start(), stop(), suspend(), and >>> resume(). The behavior of these methods is understood. Everything remains >>> in memory. Now in order to persist their state I have created a >>> corresponding entity. There are two columns of the entity, status and >>> serializedInstance which change at any stage and that is depending upon >>> user actions and workflow code. >>> >>> I have a workflow management dashboard which provides ability to view all >>> the workflows defined in the system and to start, stop, resume and suspend. >>> When I start the workflow, I call the method start() of the workflow >>> entity, which internally triggers the associated workflow's start() method >>> and also registers the entity to receive notifications from the workflow >>> thread. The workflow thread post notifications such as when it completes >>> the job or explicitly stopped, resumed, suspended etc. So upon these >>> notifications, the workflow entity's onNotify() method is invoked which in >>> turn based on the message, modifies the status column and >>> serializedInstance column value and invokes, editingContext().saveChanges() >>> inside the onNotify() method. >> >> You will have to make sure that the EC is locked before touching any of the >> entity's persistent values or calling saveChanges() >> >>> >>> I guess the story is too long but it is working fine so far. I just want to >>> confirm that if this does not break anything at any stage or cause a >>> deadlock situation? >>> >>>> >>>> Chuck >>>> >>>> -- >>>> Chuck Hill Senior Consultant / VP Development >>>> >>>> Practical WebObjects - for developers who want to increase their overall >>>> knowledge of WebObjects or who are trying to solve specific problems. >>>> http://www.global-village.net/products/practical_webobjects >>>> >>>> >>>> >>>> >>>> >>>> >>>> >> >> -- >> Chuck Hill Senior Consultant / VP Development >> >> Practical WebObjects - for developers who want to increase their overall >> knowledge of WebObjects or who are trying to solve specific problems. >> http://www.global-village.net/products/practical_webobjects >> >> >> >> >> >> >> -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
