EJB 3.1 automatic timer does not work for second

When I tried the tutorial to create timer service using EJB this morning, I found out the @Schedule annotation for second does not work as what it suppose to be (print a message every second), keep trying …. trying…..
End up, the “reason” give me a BIG Ooooooooooo …..

What I did

@Singleton
public class ScheduleBean {

    @Schedule(second = "*/1")
    public void doWork() {
        System.out.println("Hello dude... schedule is working...");
    }
}

What it suppose to be

@Singleton
public class ScheduleBean {

    @Schedule(second = "*/1", minute = "*", hour = "*")
    public void doWork() {
        System.out.println("Hello dude... schedule is working...");
    }
}


 

dicksonkho

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.