• 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: Background threads and maintenance applications - how to terminate them safely?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Background threads and maintenance applications - how to terminate them safely?
  • From: Lachlan Deck <email@hidden>
  • Date: Tue, 23 Oct 2007 12:46:33 +1000

On 23/10/2007, at 11:16 AM, Miguel Arroz wrote:

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

No. Use that information if needed.

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.

Fair enough. Okay, are you saving the user's data in the database prior to processing it? That would be the sensible thing to do if you want to be sure it'll still be there if the app dies.


Then just add a state column to the data that can indicate whether it's completed, in progress, etc.

Then you can safely have a background thread that dequeues jobs to process and can safely abort them mid-stream if the app has to go down.

If using WOnder, see ERXApplication.gracefulTerminate.

I'd be looking at java.util.concurrent (e.g., PriorityBlockingQueue, Execurtors, ExecutorCompletionService) etc.

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:
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>)
 >Re: Background threads and maintenance applications - how to terminate them safely? (From: Miguel Arroz <email@hidden>)

  • Prev by Date: Re: Background threads and maintenance applications - how to terminate them safely?
  • Next by Date: ERChangeNotificationJMS
  • Previous by thread: Re: Background threads and maintenance applications - how to terminate them safely?
  • Next by thread: ERChangeNotificationJMS
  • Index(es):
    • Date
    • Thread