@javax.ejb.Schedule

From NovaOrdis Knowledge Base
Revision as of 16:52, 25 September 2017 by Ovidiu (talk | contribs) (→‎Configuration)
Jump to navigation Jump to search

External

Internal

Overview

Used by EJB to designate timeout callback methods that will be invoked by automatically-created timers.

Example:

@Schedule(hour="3", dayOfMonth="1", info="something")
public void toBeExecutedAt3AMOnTheFirstDayOfTheMonth() {
   ...
}

Configuration

The annotation is configured using a cron-like time expression, using the following attributes:

  • second (if not specified, default is 0)
  • minute (if not specified, default is 0)
  • hour (if not specified, default is 0)
  • dayOfMonth
  • month
  • dayOfWeek
  • year

{{{1}}}

The following example fires a timer every 20 seconds, continuously:

@Schedule(hour="*", minute="*", second = "0/20")
public void fireEvery20SecsContinously() {
   ...
}