One of my implementation classes has methods that takes quite long to finish and that makes my view to freeze. So these methods must be threaded!
All these methods are returning data with HashMaps or Lists.
My controller is getting that data by calling them and then pass them to the View.
What i can't figure out is where should i create the thread. Should it be in the Controller layer or in the implementation class (and how so since i have many methods there).
Also i need to refresh the view only when the thread work is finished. These methods are going to be re-called.
I'm really lost in all those threading techniques i came across.
Controller:
SomeParser someParser = new FirstParserImpl();
HashMap<String,String> map = someParser.parseSomething();
loadTableView(map);
FirstParserImpl:
public HashMap<String,String> parseSomething() {
//opening http connection, scrape and parse data. This takes long time!
return map;
}