while (true) { try { String s = q.getTask(); System.out.println("execute task: " + s); } catch (InterruptedException e) { return; } }
这里哦 !~
//终止(阻断)线程
for (Thread t : ts) { t.interrupt(); }
Sign in to make a reply
🌙
while (true) {
try {
String s = q.getTask();
System.out.println("execute task: " + s);
} catch (InterruptedException e) {
return;
}
}