Hello,

I need some help to find the correct way to implement my need.

The need as i see it is simple : Implement a queued synchronization thread 
model where queue elements can be removed / canceled.
The second problem is that i use lots of interface so I don't really know 
the numbers of different item in queue and what the sync process do.

The need from users perspective : Interface with different screens like for 
example movie / music / tv show / .... each with a refresh button that 
allow refresh of data (can take some time) and an cancel button if it's 
taking too long and the user change his mind.

What I do now is : A service that adds sync details to a queued list and 
start the working thread if it's not. This works ok but does not support 
canceling.

The problem now is how to handle cancellation, should i start new thread 
for the sync in the queue thread and associated it with current action 
someway, should i cancel the main thread and restart it (but what about 
cancellation that can takes times if sync is locked in sockets so going ANR 
...).

I suppose there's a pattern to handle that but I can't find it :(

And a little supplemental question that is linked to this, the sync process 
can be for example a function that call 3 functions that each takes a lot's 
of time, in each functions I can check for thread.interrupted to stop it, 
but from documentation it clears the flag so the main function won't know 
and will continue to other calls so again what's the correct way to handle 
the interrupt propagation ?

Thanks for your help,
Tolriq.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to