0

I am evaluating an application based on Java on Google App Engine.

I want to create a certain task within a pull queue which will be picked up by a worker (most likely managed vm) who will work basically indefinitely on that task. To make sure that the task is executed i want to make that worker lease a task from the pull queue for lets say 1min.

sequence diagram showing pull queue interaction

After that time i want to extend the lease if the worker is still alive (This makes sure it is actively doing something).

My question is now: Is there a possibility to block the worker from extending the lease in order to stop the worker?

If this is not possible i would have to make a call to the worker and make him delete the task, but if it was possible to block him from extending the lease it would be much more elegant, beside the fact, that i have to delete the task afterwards anyway

pfried
  • 5,000
  • 2
  • 38
  • 71
  • wouldn't push queues be better suited for your need? why do you need to manage the worker lifecycle manually? – jirungaray Mar 25 '15 at 13:23
  • because i intend to use the managed vm feature. Basically i need to run Threads which is not possible without using compute or the managed vm – pfried Mar 25 '15 at 14:19
  • Well you can actually use threads using [App Engine modules](https://cloud.google.com/appengine/docs/java/modules/), no need to use managed VMs or GPE. Still, using local threads on App engine might cause some bad (unexpected) behavior. try to avoid them at all costs using task queues or crons. – jirungaray Mar 25 '15 at 14:47
  • oh i wasnt clear enough about that. I have to use a 3rd party lib which spawns threads. For the modules i need to create a runnable which i pass to the threadManager, but this is not possible in my case i guess – pfried Mar 25 '15 at 15:14
  • any way to use/inject a the generic ThreadFactory returned by ThreadManager.backgroundThreadFactory() into that lib? – jirungaray Mar 25 '15 at 15:25
  • no unfortunately i cannot change the code and it is not programmed this way. I call `start()` and there it goes – pfried Mar 25 '15 at 15:41
  • Then i guess you are stuck in a Managed VM my friend. – jirungaray Mar 29 '15 at 17:28

0 Answers0