Why the JDK Timer for Spring is not working?

Im writting a Spring Application, which has to run a task in a new thread that should be started every couple of seconds. My XML looks like this:

<bean id="checkEmail" class="com.turbineam.dataloader.commons.QuartzSchedulerBean"></bean>

<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
    <property name="delay" value="1000" />
    <property name="period" value="1000" />
    <property name="timerTask" ref="checkEmail" />
</bean>

And for Java code I have:

package com.turbineam.dataloader.commons;
import java.util.TimerTask;

public class QuartzSchedulerBean extends TimerTask {

    @Override
    public void run() {
        System.out.println("printMe!");
    }
}

But it doesn't affect my whole program (which makes something else)

how can I make this right?

Kind Regards,

RafaƂ

Answers


You're missing a TaskExecutor implementation.

See: http://static.springsource.org/spring/docs/2.5.x/reference/scheduling.html#scheduling-task-executor


Need Your Help

plot from a large data set into several figures

python numpy plot

I have a large set of particle position data from a movie made by a detection camera in a physical experiment. The first column just gives the frame number, the second to fourth column is x, y, and z

A Problem in Pinvoke

c# .net interop pinvoke marshalling

I have the following function in C++ native dll, and I want to use it in a C# app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.