I have a problem with one of my apps, when I attempt to get a DB connection or execute a query sometimes a table is locked, or the resource is unavailable. When this happens the application grinds down to a crawl because the requests are queing up, I have an alternate data source that i can access when my primary resource is unavailable. So i was thining threads are the solution to this problem. I assume I would have the call to the DB in a thread and also have a timer thread, so that if the DB call doesnt return by the time the timer thread wakes, then i teminate the DB call. Is this the proper way of thinking about this problem?
Here are some issues I am running into,
first if my Db class extends thread, then the only way for me to have it execute in its own thread is to call start, and have a run method. This would mean that each class that extends Thread can only execute the code in its run method and the code run calls(and still be in its own thread) right?
Wouldnt this be a problem, for example I have a DB manager class that you pass a SQL statement to and it will execute a query or an update, or an insert, how would I pass the statement if run doesnt take arguments?
am I totally lost here?
thanks guys
Jesse