How to create automatic Timers

Automatic timers are created by the EJB container when an enterprise bean that contains methods annotated with the @Schedule or @Schedules annotations is deployed. An enterprise bean can have multiple automatic timeout methods, unlike a programmatic timer, which allows only one method annotated with the @Timeout annotation in the enterprise bean class.

Automatic timers can be configured through annotations or through the ejb-jar.xml deployment descriptor.

Adding a @Schedule annotation on an enterprise bean marks that method as a timeout method according to the calendar schedule specified in the attributes of @Schedule. The @Schedule annotation has elements that correspond to the calendar expressions detailed in Creating Calendar-Based Timer Expressions and the persistent, info, and timezone elements.

Example: The following timeout method uses @Schedule to set a timer that will expire every Sunday at midnight:

package com.sample;
import javax.ejb.Stateless;
import java.util.Date;
import javax.ejb.Schedule;

public class AutomaticTimerBean
     @Schedule(dayOfWeek="Sun", hour="0")
     public void automaticTimer()
           System.out.println("\n\n\t Automatic Timer invoked at: "+new Date());

If you want a reference to Calendar Based Timer Expression take a look at this link.