Announcement Announcement Module
No announcement yet.
Scheduling in Cluster Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scheduling in Cluster

    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?

    <bean id="simpleReportTrigger"
    		<property name="jobDetail">
    			<ref bean="dealFeedGeneration" />
    		<property name="cronExpression">
    	<bean id="dealFeedGeneration"
    		<property name="targetObject">
    			<ref bean="feedTaskGenerator" />
    		<property name="targetMethod">
    		<property name="triggers">
    				<ref bean="simpleReportTrigger" />

  • #2
    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.


    • #3
      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


      • #4
        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.


        • #5
          He cannot change the table, but he didn't say that he cannot add a table.


          • #6
            I assumed he couldn't use a Quart database Job Store, but would still be able to hit the database. BSShaun, is this the case?


            • #7
              Thanks for your response

              Could you please explain both the methods

              1. Do i need to create a table to control the scheduling process. Can it be controlled by xml configuraion itself. How that table controls the process

              2. If i need to use JobLauncher interface, Can't i use MethodInvokingJobDetailFactoryBean to invoke my method at schedule time.

              Could you please give me a link which explains configuration / coding changes. I am not aware of this concept.


              • #8
                The table is needed as a central location to store the fact that a job already started. Configurationc an still be in xml, it is simply the state of the job that is stored.

                Question 2 yeah sure you can, but the fact/issue with that is if you do that in a cluster of 4 machines 4 jobs are scheduled... And that is something you don't want.