Search code examples
javaglassfish-3

Method with multiple @Schedule annotations does not pick second line


I have stateless bean on Glassfish server v 3.1.2 with two methods which should be executed by schedule. One method should be executed once in a week and annotated as follows:

@Schedule(dayOfWeek = "Sun", hour = "1", minute = "5", second = "0")

Second one runs every 15 minutes, except times when first method runs and annotated

@Schedules({
    @Schedule(dayOfWeek = "Mon-Sat", hour = "*", minute = "*/15", second = "0", persistent = false),
    @Schedule(dayOfWeek = "Sun", hour = "0,2-23", minute = "*/15", second = "0", persistent = false)
})

Problem is that second method runs every second from Saturday 23:45 until Sunday 00:00, then resumes execution nomrally, every 15 minutes. That suggests, that something wrong with Sunday schedule, but have no idea what's wrong. @Schedules Javadoc notes that this annotation available from Java 6.

Any ideas welcome.


Solution

  • As no responses received, solution was found by experimenting. The solution was to rewrite @Schedules annotation as follows.

    @Schedules({ @Schedule(dayOfWeek="Mon,Tue,Wed,Thu,Fri,Sat", hour="*", minute="*/15", second="0", persistent=false), @Schedule(dayOfWeek="Sun", hour="0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23", minute="*/15", second="0", persistent=false) })