Java ee6 program scope

I need a schedule that runs every 5 minutes from 10 a.m. to 5:45 p.m. how can I do this with the @ schedule annotation?

So far, I'm limited to @ schedule (hour = 10-18; minute = * / 5), but they insist on continuing until 5:45 p.m., not 6 p.m

Solution

As described in documentation for @ schedule and @ schedules, if you run two schedules, you need to have two @ schedule comments - even if you don't like the fact

Since there are similar restrictions only in the range of individual elements (hours, minutes, seconds...), it is not feasible to skip the additional information of the last two executions only at *: 50 and *: 55 at 5 p.m

That is, you may end up with something like this

@Schedules({
   @Schedule(hour="10-16" minute="*/5"),@Schedule(hour="17" minute="0,5,10,15,20,25,30,35,40,45")
})

When you end the progress information to your source code in the final way (even if it is in the form of a comment), you can run it every five minutes and return from the method immediately if it is called after 5:49 p.m

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>