Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda