Skip to content

Tag: cron

Can the following two cron expressions be used interchangeably?

I am trying to understand how Cron expressions are written and interpreted in Java. I am unable to understand how the two expressions listed below differ in physical sense: Expression 1: * * * 1/1 * ? * Expression 2: * * * * * ? * I referred to the description provided by CronExpressionGenerator and their des…

Alfresco cron syntax: difference between 0/2 and */2?

Alfresco has a cron-like system that allows you to run a job at regular intervals. The documentation specifies as an example the expression 0 0/2 * * * ? which will make the job run every 2 minutes. However, in a lot of code I see people using the expression 0 */2 * * * ? instead, the difference being

How to validate CronSequenceGenerator cron expressions?

How could I validate cron expressions that are prepared for use of CronSequenceGenerator? I mean, I cannot wait until the cron executes automatically as I’m defining like monthly intervals. Is the following correct? How can I be sure? Answer The Spring’s CronSequenceGenerator class has a method is…

How do I execute a method at a particular time in java?

Is there any way to write a program in java, so that its main method schedule (or at a 10-15 min interval) another method to executes it at a particular interval? Answer I think you are looking for the Time class. See Timer Class API You can use this class like: You want to perform a Method every 600 miliseco…