“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
I am looking for a solution from database perspective
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
I am writing a job scheduler the job details are stored in the RDBMS database.
Venkat:
I want to ensure at the same time only one thread does the job scheduling, other thread should wait or should go to sleep mode.
James: I think your design will be cleaner if you implement you own POJO-based server. You certainly will have greater control of the threads.
apigee, a better way to API!
I think you can do away with a lock table in the database.
This table just has a column to indicate whether some thread is working on the job.
After a thread is done with the job, it will set the flag back to "free" so that any other thread can take it up in the next iteration.
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
Venkat:
My concerns are what if the job fails without updating the flag as free?
apigee, a better way to API!
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
scheduler with thread implementation
Do you you mean that a job needs to be run only once?how do I ensure that only one thread runs in clustered environment
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|