I have a thread array in which each thread gets a search task from a thread search manager - using a producer/consumer module - and when it finishes it, it waits until the next signal from the search manager thread. The search is performed via web - and it takes a significant amount of time (mainly the getting the html data part). My problem is when the user selects to stop the current searches and to start a new set of searches, all the searches are busy during the previous web search, so currently, the user waits until the no-longer-relevant searches end their task and begin the new one.
My question is - how can I start immediately with the new relevant task? I couldn't use a flag (to indicate the thread to skip the search) since the long wait is for the get http method. Is there a way to stop aggressively the method and to start it from the beginning? (I prefer not using new thread...)
Thanks in advance,
Shmouel.