0

How i can make more thread to do same loop task without repeat ? I want to increase speed of my code

thread th = new thread(); public void run(){ for(int i=0;i<=10000;i++){ try { URL url = new URL(i // here i meant that every loop url chang); URLConnection yc = url. openConnection(); BufferedReader br = new BufferedReader( new InputStreamReader(yc.getInputStream())); String inputline; while((inputline=br. deadline())!=null) { if (inputline. contains("j")){ //do somthings } } } catch {} } }};th. start

22nd Dec 2016, 5:15 PM
ayoub
ayoub - avatar
2 odpowiedzi
+ 1
create new threads with the loop than url
22nd Dec 2016, 6:38 PM
Kibrom
Kibrom - avatar
0
how this?
22nd Dec 2016, 7:02 PM
ayoub
ayoub - avatar