Entry :
There is a console application (JRE1.6 !!!), it creates a configuration for future child threads, it can start child threads and (need to be implemented) stop child threads.
1. The main thread main starts the child threads and terminates;
2. Child threads run in an infinite loop;
3. Child threads cannot create threads;
Tell me if I think correctly:
Stop child threads from main thread main with the command
String[] cmd = { "/bin/bash", "-c", "killall " + PID }; ProcessBuilder processBuilder = new ProcessBuilder( cmd ); Process process = processBuilder.start(); But for this method you need to know the pid of the child process.
Question :
How do I get the pid of the child process?
P.S.
I could only find information on how to get the PID of the parent process:
String proccessName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName(); Long pid = Long.parseLong( proccessName.split( "@" )[0] );
Главный поток main запускает дочерние потоки.Thread.start()it run them with the help of some analogue ofThread.start()or is it launching a third-party application through the system? - Temka also