P
Philipp Kraus
Hello,
I would like to create a thread pool for a simulation environment. I
use a pool with objects an each object must be run once in a time step,
eg in pseudo code:
while (true)
{
each thread in thread pool
{
get object from working list
object.run
push object into finished list
}
wait for all threads are finished
swap finished list with working list
if user sends a wait signal
wait
if user sends a stop signal
{
clear working list
clear finish list
remove all threads
break
}
}
Which datastructures can be used in Java for this structure? IMHO I
would like to use ExecutorService
but how can I create a pool which can be run again? In which way can I
create a good and fast solution?
Hope for some ideas for this problem. Thanks a lot
Phil
I would like to create a thread pool for a simulation environment. I
use a pool with objects an each object must be run once in a time step,
eg in pseudo code:
while (true)
{
each thread in thread pool
{
get object from working list
object.run
push object into finished list
}
wait for all threads are finished
swap finished list with working list
if user sends a wait signal
wait
if user sends a stop signal
{
clear working list
clear finish list
remove all threads
break
}
}
Which datastructures can be used in Java for this structure? IMHO I
would like to use ExecutorService
but how can I create a pool which can be run again? In which way can I
create a good and fast solution?
Hope for some ideas for this problem. Thanks a lot
Phil