I am new to spring. I have implemented a schedule that calls a method every 10 seconds. which looks like
<bean id="bidApprovalJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="bidApprovalOperations" />
<property name="targetMethod" value="checkExpiredAuctions" />
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="bidApprovalJob" />
<property name="repeatInterval" value="10000" />
<property name="startDelay" value="5000" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="jobDetails">
<list>
<ref bean="bidApprovalJob" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="simpleTrigger" />
</list>
</property>
</bean>
But this schedule works all the time. I want to start a schedule at runtime when the user clicks a button and stops it after a certain time.
Can I run a schedule from my class method? Can I instantiate a schedule in a class and then start and stop this?
Thanks in advance.
source
share