Hello,

we have some problems with the periodical execution of a function. We're using 
tapestry version 5.2.6. Since we don't want to update the tapestry version 
right now, we can not use the tapestry timer and have to use the Java Timer.

Our timertask looks like:

public class OurTimerTask extends TimerTask {
@Inject
OurService ourService;

        @Override
        public void run() {
                ourService.execute();

        }
}

And the service that starts the timer:

Timer timer = new Timer("MyTimer");
OurTimerTask timerTask = new OurTimerTask();

                // its the date of the first execution. It should be in the 
night of the
                // current day

timer.schedule(timerTask, 100,100);

The problem now is that the Inject in our TimerTask doesn't work. We tried this 
in many ways but the object ourService is always null if the run() function 
gets called. Without the Timer it works. Is it even possible to Inject a 
service for the timer? We hope that anyone can help us.

Kind regards
Daniel

Reply via email to