|
public class Bogus2 {
public static void main (String[] args) {
Thread t = new Thread(
new Runnable() {
public void run() {
int i = 0;
while (!Thread.interrupted()) {
System.out.println(i++);
}
}
});
t.start();
try { Thread.sleep(50); } catch (InterruptedException ie) {}
t.interrupt();
}
}
isnt the above code just for one thread running.
hello i am a student and a beginner learning MT so my apologies in advance if my questions are not clear.
so what if we have array of threads and there are concurrent threads running and after some times of processing later we dont need one of the thread, is there a way to kill it.
since i am doing a client/server app is it that the thread dies if the client disconnects.
|