Hi all,

I tried to build a timer using TimerFactoryBean and ScheduledTimerTask.

I managed to run the program normally and as expected if I put fork="true" in my Ant build.xml.

[java] 2007-10-30 22:08:49,652 INFO [main] timer.TimerFactoryBean (TimerFactoryBean.java:95) - Initializing Timer
[java] 2007-10-30 22:08:49,652 DEBUG [scheduledTasks] impl.SalesNoteDaoImpl (SalesNoteDaoImpl.java:161) - 1st: F1=Tue Oct 30 16:51:47 CST 2007, F2=Tue Oct 30 16:51:47 CST 2007
(lots of DEBUG messages skipped...)

However, if I wrote fork="false" in my build.xml, the program just exited after printing this:

[java] 2007-10-30 22:08:49,652 INFO [main] timer.TimerFactoryBean (TimerFactoryBean.java:95) - Initializing Timer
BUILD SUCCESSFUL
Total time: 28 seconds

This happened no matter I run inside Eclipse or a DOS prompt.

This is the segment in my build.xml:

<target name="run" depends="compile">
<java classname="myclass.SalesReportAutomation" fork="true" classpathref="run.class.path" maxmemory="128m">
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
</java>
</target>

and how I set in the context:

<bean id="scheduledEmailTask" class="org.springframework.scheduling.timer.Schedu ledTimerTask">
<property name="timerTask" ref="emailTask"/>
<property name="period" value="30000"/>
</bean>

<bean id="scheduledTasks" class="org.springframework.scheduling.timer.TimerF actoryBean">
<property name="scheduledTimerTasks">
<list>
<ref bean="scheduledEmailTask"/>
</list>
</property>
</bean>

and how I get the TimerFactoryBean in source code:

ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext-sybase.xml");
applicationContext.getBean("scheduledTasks");

Everything just worked fine if I put fork="true", but I want to run the program with fork="false".

Any hints?