Hello everybody,
the Java program I'm currently developing must allow parallelization in terms of multithreading.
My plan is to use ExecutorService thread pool in order to keep the number of concurrently running Threads at the level specified by the user.
Since the software will be featuring a complex GUI with Swing elements one day, which needs to stay responsive and receive updates from running background tasks, I decided to use SwingWorkers instead of standard Threads.
According to what I read, SwingWorkers spawn (up to 10) Threads without possibility to specify how many.
The big question is now, whether each SwingWorker submitted to the ExecutorService will potentially spawn ChildThreads or whether this is prevented by the ExecutorService?
In other words: do I lose control of how many threads are really used simultaneously?
When I set the number of Threads to 1 in initialization of the ExecutorService and submitted a SwingWorker, I observed already full consumption of all CPUs in my i5 laptop.
I hope somebody can help me here.
Thank you, and best regards,
Apotekarnes
the Java program I'm currently developing must allow parallelization in terms of multithreading.
My plan is to use ExecutorService thread pool in order to keep the number of concurrently running Threads at the level specified by the user.
Since the software will be featuring a complex GUI with Swing elements one day, which needs to stay responsive and receive updates from running background tasks, I decided to use SwingWorkers instead of standard Threads.
According to what I read, SwingWorkers spawn (up to 10) Threads without possibility to specify how many.
The big question is now, whether each SwingWorker submitted to the ExecutorService will potentially spawn ChildThreads or whether this is prevented by the ExecutorService?
In other words: do I lose control of how many threads are really used simultaneously?
When I set the number of Threads to 1 in initialization of the ExecutorService and submitted a SwingWorker, I observed already full consumption of all CPUs in my i5 laptop.
I hope somebody can help me here.
Thank you, and best regards,
Apotekarnes