Friday, October 22, 2010

Looping in different Threads?

My last post ends with looping in different threads. Yes, that is not clear enough to understand what it is. Let check some situation where this may applicable.
In google app engine, It is a request based engine, where http request will be placed and our application should process and provide result back. But we have a limitation; each request should return within 30 seconds. But google app engine provides a task queue implementation where we can post request to that queue and which will be executed later. So, say if we want to process a request which last more than 30 seconds we should split that into small parts and post to task queue.
Mostly, if we want to process a collection, then we will go for looping. But in the case of google app engine, for every item of that collection, we should post request one after other by holding a counter in bigTable (google app engine datastore) .
Here if you see this we are looping a collection but each item will be processed in different threads.
Ok, Now think a senario where you want to loop from middle to end and start of a collection then we need to find some better way.

No comments: