+ 1

Multithread problem !

try { String sr = textArea1.getText(); Pattern pat = Pattern.compile("(https?|rtmp|http)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]", Pattern.DOTALL); ` Matcher matcher = pat.matcher(sr); int count = 0; while (matcher.find()) { new Thread(" "){ public void run(){ try { URL url = new URL (matcher.group()); URLConnection yc1 = url.openConnection(); ...........

20th Jan 2017, 6:49 PM
ayoub
ayoub - avatar
2 Antworten
+ 1
new Thread(new Runnable(){ public void run(){ //code... } }).start();
20th Jan 2017, 7:01 PM
Uran Kajtazaj
Uran Kajtazaj - avatar
0
thanks bro but the problem that matcher group inside thread won't work it's seems that's must be final!?
20th Jan 2017, 7:14 PM
ayoub
ayoub - avatar