This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Scheduling in Cluster

Nov 6th, 2007, 10:50 PM

I am using quartz for scheduling purpose. When application is deployed in weblogic cluster environment, the entire server initiates the process. I donít have DB operation, so that can use select for update query to lock the table and be sure that only one server starts the process. I have file writing operation. Is there any way to configure the quartz to initiates only once?

I'm not sure I fully understand the question. By initiate, are you referring to the Quart servlet listener that will create a scheduler? And what do you mean by only once? Once per server, or once total? Keep in mind that even if you have say, one quartz scheduler per server, you can use Quartz' clustering features to ensure that only one scheduler kicks off a job. However, this has the unfortunate side effect of requiring your job schedule to be in the database.

Comment

I need one scheduler kicks off a job. Can you give me the configuration Quartz' clustering feature.
My Requirement is to get all the data from one table and write in to the file. I can't change the table to add or delete one more column. Since the application is deployed in cluster env, all the servers kicks off the process and there is a possibility the file is overwritten. I need to avoid this situation and make sure that only one server kicks off the process

Thanks in advance

Comment

It is my understanding that you cannot use any clustering features of Quartz without using the database as a JobStore. I have heard that later features will remove this requirement, but for now that seems to be the only option. If you can't add support for a database job store, then I think you will have to code your own solution. This could be implemented using the JobLauncher interface. If JobLauncher.isRunning() returns false, call start, if not let that thread finish.