Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Java EE6 Schedule Range

I'm required to have a schedule that runs every 5 minutes from 10 am to 5:45pm, how do I do this with the @Schedule annotation?

So far, I'm limited to the @Schedule(hour=10-18;minute=*/5), but they insist I should have it until 5:45pm not 6pm.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

As clearly stated in the documentation for @Schedule and @Schedules, you need to have two @Schedule annotations if you run two schedules - even if you don't like that fact.

Due to the cron-like limitations of having ranges only within individual elements (hours, minutes, seconds...), it's simply not posible to give that additional information of skipping the last two executions at *:50 and *:55 only at 5pm.

That said, you'd probably end up with something like

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

As you end up with schedule information into you sourcecode that way (even if it's in the form of an annotation) you could just as well run every five minutes and immediately return from the method if called after 5:49pm

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda