Monday, 15 September 2014

android - how to traverse a queue in java -



android - how to traverse a queue in java -

i have threadpoolexecutor fulfils downloadtask implements runnable{private string taskid... tasks , need have possibility in time define task threadpoolexecutor queue, example, using task id:

mdownloadtaskspool.getqueue();

what best way travesre queue , define element?

it's possible have list duplicates tasks looks not elegant.

subclass runnables provide getter taskid (if that's key). create concurrent map, mapping taskid runnable set in queue. subclass threadpoolexecutor. in beforeexecute, remove current task map since it's not in queue anymore. may want cast runnable custom class utilize taskid getter.

java android concurrency

No comments:

Post a Comment