Yes Jordan you're right the part that keeps my instance open is: (I've removed the polling queue code and sleep part ,the instance shutdown successfully)
Thread.sleep(MILLISECONDS_TO_WAIT_WHEN_NO_TASKS_LEASED); which sleeps the thread for 2.5 seconds if there is nothing in the queue then poll again, and I dont know any other way to keep pooling the pull queues. You suggested to me to use shutdown triggers, but as far as I know shutdown triggers are for manual scaling. However I dont want to use manual scaling because in that case I've to calculate when should I shutdown the instance and I also need to decide when to wake the instance. Instead I'm trying to use basic scaling because it automaticly wakes when a new request arrive and also automaticly shutdowns when the idle-timeout time arrives. Can you suggest me a solution 9 Aralık 2016 Cuma 00:01:54 UTC+3 tarihinde Jordan (Cloud Platform Support) yazdı: > > App Engine Basic scaling > <https://cloud.google.com/appengine/docs/java/how-instances-are-managed#introduction_to_instances> > > makes use of Dynamic Instances. Dynamic instances turn off when they are not > being used At All. > <https://cloud.google.com/appengine/docs/java/how-instances-are-managed#scaling_dynamic_instances> > Therefore, > since your loop continuously runs, it is forcing your instance to keep > alive and never become idle. The only part in your code block that could > possibly hit your two minute idle-timeout is your 'Thread.sleep( > MILLISECONDS_TO_WAIT_WHEN_NO_TASKS_LEASED);'. > > If you want to properly test your loop, I would recommend performing one > of the listed Shutdown Triggers > <https://cloud.google.com/appengine/docs/java/how-instances-are-managed#shutdown>. > > As noted in the blue box > <https://cloud.google.com/appengine/docs/java/how-instances-are-managed#shutdown> > under > the 'Shutdown' section, using LifecycleManager is not reliable and you > should not base your code on it. There are many reasons why the > LifecycleManager wont get a chance to run during instance shutdown, which > could cause many problems in your coding logic. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/1058a901-c0f6-4be4-a226-e4cbed2a2b39%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
