java - Threading HttpUrlConnection -
i have 10 lists contains location data, each list has 10.000 entries. starting executerservice thread work. executorservice executor = executors.newfixedthreadpool(locationlocationlist.size()); for(list<location> locationlist: locationlocationlist){ executor.execute(new testthread(locationlist)); } it takes soo long finish work, in 10 threads. expensive part seems 1 open url , connect it. idea how can tune this? @override public void run() { while(isrunning){ gson gson = new gson(); map<integer, data> map= new hashmap<integer, data>(); for(location location: locations){ string data = getjson(location.getlatitude(), location.getlongitude()); data data= gson.fromjson(data, data.class); map.put(location.getid(), data); } weatherdao.setweatherfast(map); isrunning = false; } } ...