This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Scheduling issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Scheduling issue" Watch "Scheduling issue" New topic
Author

Scheduling issue

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108

Joined: Apr 08, 2008
Posts: 73
posted Today 9:50:52 AM 0
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.MethodInvokingTimerTaskFactoryBean">
<property name="targetObject" ref="processOrderTimer" />
<property name="targetMethod" value="processOrder" />
</bean>

<bean id="processOrderTimer" class="dk.tdc.kvikoc.app.osm.ProcessOrderTimer" scope="singleton">
<property name="osmBO">
<ref bean="osmBO" />
</property>
</bean>

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

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


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.


Regards,
Gaurav
 
jQuery in Action, 2nd edition
 
subject: Scheduling issue
 
Similar Threads
How to pass values to spring schedular at run time?
Spring Timer Help required
Urgent : Scheduling jobs using Quartz or Timer.
AOP configuration seems to be invalid
Spring Timer Help required