0

I create some threads:

public class NewUser extends Thread{

    public int userID;
    public long waitingSeconds;
    Timer timer;


    public NewUser(int UserID, long WaitingSeconds){
        this.userID = UserID;
        this.waitingSeconds = WaitingSeconds;
    }

    public void run(){

        timer = new Timer();        
        timer.schedule(timerTask, waitingSeconds*1000);
    }  
}

In other class:

NewUser user = New NewUSer(4,604800); //one week
user.start();

I would like to kill all the "NewUser" threads, but I don't know how to find it in my ubuntu.

How should I get them?

user1256477
  • 10,763
  • 7
  • 38
  • 62
  • 1
    You can kill the java process with `ps -ef | grep java`. You will not see java threads in Operating system processes. These threads are internal to JVM and they run inside an instance of a JVM. – ShaggyInjun May 20 '13 at 14:50
  • If I read the code correctly, the `NewUser` threads will die naturally very quickly after being started. However, each one will start a separate thread associated with the `Timer` object that is created. Also, why would you want to kill these threads using Ubuntu? – Mike Tunnicliffe May 20 '13 at 14:52

0 Answers0