I am new to java and I am doing this multithreaded application in Java Swing.
I need to create a custom class which can spawn multiple threads and execute those threads at the same time.
Is it a good idea to use Process to spawn threads?
Since it is not possible to extend from ProcessBuilder class, Is there any other way to implement the process as a class?
Please share your thoughts.
Thanks.
Is it a good idea to use Process to spawn threads?
No. That's designed to spawn processes, which are very different.
You can either create threads directly with code such as new Thread(runnable).start()
, or use an ExecutorService
for pooling etc.
See more on this question at Stackoverflow