M
mortb
Hi all!
In my webb app I'm about to introduce a way of processing long running tasks
in the background.
As the long running task gathers data from a database process them and
compile them into a file appx 80 mbytes large it is a resource demanding
task both of the CPU and the memory.
So I think I should restrict how many of these tasks that should be able to
start and make them run in the background.
First I read about the Thread class and thougth: Fine I'll use a thread and
then I'll write a utility class that will queue the tasks and make them run
either one after one or not too many at a time.
I'd set threads' priority to belowNormal or lowest.
Then I discovered the threadpool class and thought: Hey here's the queuing
abillity I was looking for. But then I found no way of setting the priority
of the thread that would start the long running task and I don't want to
make the web pages serve slowly.
Does anyone have any advice on whether I should use the threadpool or create
thread objects "on my own" in the code?
Thanks in advance!
mortb
In my webb app I'm about to introduce a way of processing long running tasks
in the background.
As the long running task gathers data from a database process them and
compile them into a file appx 80 mbytes large it is a resource demanding
task both of the CPU and the memory.
So I think I should restrict how many of these tasks that should be able to
start and make them run in the background.
First I read about the Thread class and thougth: Fine I'll use a thread and
then I'll write a utility class that will queue the tasks and make them run
either one after one or not too many at a time.
I'd set threads' priority to belowNormal or lowest.
Then I discovered the threadpool class and thought: Hey here's the queuing
abillity I was looking for. But then I found no way of setting the priority
of the thread that would start the long running task and I don't want to
make the web pages serve slowly.
Does anyone have any advice on whether I should use the threadpool or create
thread objects "on my own" in the code?
Thanks in advance!
mortb