We are using ScheduledTimerTask to manage the jobs(automatic) in our application.We are using the following code:
<bean id="SampleTask"
class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">
<property name="targetObject" ref="sampleScheduler" />
<property name="targetMethod" value="runMethod" />
</bean>
<bean id="sampleScheduler" class="com.sample.SampleScheduler" />
<bean id="timerTask"
class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="timerTask" ref="schedulerTask" />
<property name="delay" value="1000" />
<property name="period" value="60000" />
</bean>
<bean class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>
<ref local="timerTask" />
</list>
</property>
</bean>
By using the above code runMethod
is working fine for every one minute.But we would like to change the execution based on server time.For example,If time in server is 6 PM then we need to invoke the function.How to achieve it?
Help would be appreciated.