For example, I launched threads 1,2 and 3, how do I keep an eye on the state of the threads? Or how do I get return values from them?
Lets say I have a server class that has threads listen(), I would like to be able to get some values from listen() or vice versa.
Server -> listen().getValue().
listen() get arraylist from server.
I believe what you are looking for is called Java IPC (inter process communication) mechanisms. There are plenty. For IPC in a single JVM, you can look into java.util.concurrent package, such as ConcurrentLinkedQueue .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.