Hi and thanks for help up front.
Im not exactly new to xoxo but I feel like a newby within this area so Ive put post here.
Ive written a web app that uses a subclass of THREAD to run all my database calls.
To be honest I was ignorant of web thread until a day ago.
My question is using a THREAD here really ok or does best practices say I should use a WebThread ?
I understand a web thread keeps a weak ref to the session.
Have I opened myself up to some future issues because of my choice?
Thanks for any comments.
The main reason to use a WebThread is that its session is retained. That means that if you do anything that would require manipulating the session, the framework can accurately figure out which session it belongs to. If you’re doing something that is not session sensitive, you could use a regular thread.
I guess all is fine then .
I kill the thread from inside the thread when it has run all its code and
I attach an event to tell me when the thread has finished.
And everything seems to work ok, but I’m never sure if it’s the “right” way to clean up a thread.
Again thanks for your time
When I run my WebThreads I also start a WebTimer. The WebTimer checks to see if the thread is still running. If it is running, it displays any messages from the thread. If it is not running, it runs all the post=thread code such as hiding the Progress wheel and displaying the thread data. I almost never kill a thread.
I have multiple database calls ie “selects” all happening very close together with each one in their own thread. I’ve always assumed treads should’ve killed of after use. Unless they poll in a loop looking for triggers to restart the next job.
Do you know if there are penaulties for using multiple threads ie memory use or time delays?
My app isn’t in production so I haven’t had any stress tests on this design yet.
Thanks for your comment. It’s making me think
You shouldn’t kill a thread from within itself. Just return out of the run event and let the thread clean itself up.
Appreciate the heads up. Ill update my code