Announcement Announcement Module
No announcement yet.
Spring Timer Help required Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Timer Help required

    Hi All,

    I am using Spring timer schedule framework for job execution. Below is the code details :

    In XML file :
    <bean id="schedulerTask" class="org.springframework.scheduling.timer.Method InvokingTimerTaskFactoryBean">
    <property name="targetObject" ref="processOrderTimer" />
    <property name="targetMethod" value="processOrder" />

    <bean id="processOrderTimer" class="" scope="singleton">
    <property name="osmBO">
    <ref bean="osmBO" />

    <bean id="timerFactory" class="org.springframework.scheduling.timer.TimerF actoryBean">
    <property name="scheduledTimerTasks">
    <ref local="timerTask" />

    <bean id="timerTask"
    class="org.springframework.scheduling.timer.Schedu ledTimerTask">
    <property name="timerTask" ref="schedulerTask" />
    <property name="delay" value="6000" />
    <property name="period" value="600000" />

    public class ProcessOrderTimer {

    public synchronized void processOrder() {

    //some lines of code

    //call to below method involves call to a webservice hosted on other machine
    response = osmBO.createOrder(arg);


    Now problem is before call to createOrder (in turn webservices) is finished that is response is received another thread(probably created by app server where this code is running) invokes this method.

    My requirement is untill processOrder() invocation gets completed by one thread another thread must not be able to access it. i have method the synchronized but of no help.

    Any pointer how to do this.