Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background threads and maintenance applications - how to terminate them safely?



Hi!

So, the ideia is to override the isTerminating method, and only return true is things are safe to terminate?

WOLongResponse won't solve my problem, because the user will introduce the data, get the "OK" page, close the browser and go away. I don't want him to be waiting, because, unless the whole server goes down, I'm sure, at that point, that all the data is valid and can be saved with no problems.

  Yours

Miguel Arroz

On 2007/10/23, at 01:08, Lachlan Deck wrote:

Hi there,

On 23/10/2007, at 9:30 AM, Miguel Arroz wrote:

My problem is: I have two types of situations that worry me:

1) A maintenance app that is running on the server, with no user interaction. It just seats there, in an infinite loop, doing stuff that need to be done.

See below.

2) A normal app that sometimes launches a background thread to process some stuff. The ideia is that the user submits data, but the data processing may take some time (30 seconds, for example). What I want is to send the "OK, great, it's done" page to the user, terminate the session, and process his data in the background before saving it.

WOLongResponse + NSNotificationCenter.

My question is: how can I terminate this apps safely? When we are talking about sessions, we have the "Refuse new sessions" option, that will hold the app until no more active sessions exist. This will terminate apps safely, without discarding data. How to do this with background threads? How can I tell WO "do not terminate the app until this thread is over or this method is done"?

See WOApplication.terminate/isTerminating.

with regards,
--

Lachlan Deck



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/arroz% 40guiamac.com


This email sent to email@hidden

Miguel Arroz http://www.terminalapp.net http://www.ipragma.com



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:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden

References: 
 >Background threads and maintenance applications - how to terminate them safely? (From: Miguel Arroz <email@hidden>)
 >Re: Background threads and maintenance applications - how to terminate them safely? (From: Lachlan Deck <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.