com.atlassian.scheduler.core.util
Class CronExpressionQuantizer
java.lang.Object
com.atlassian.scheduler.core.util.CronExpressionQuantizer
public class CronExpressionQuantizer
- extends Object
Utility class to prevent the use of cron expressions that run more frequently than once per minute.
It is assumed that the cron expression has already been validated or that it is acceptable for the
validation to return the "wrong" message when the expression is validated later on.
Without this, people could supply cron expressions that run every five seconds or something
equally inappropriate.
- Since:
- v1.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CronExpressionQuantizer
public CronExpressionQuantizer()
quantizeSecondsField
public static String quantizeSecondsField(String cronExpression)
- Quantize the seconds field using
CronExpressionQuantizer.Randomize.AS_NEEDED.
- Parameters:
cronExpression - the cron expression to (possibly) quantize.
- Returns:
- the cron expression with the seconds field forced to a random value between
0 and
59 (inclusive) if it is not already in that format
quantizeSecondsField
public static String quantizeSecondsField(String cronExpression,
CronExpressionQuantizer.Randomize randomize)
- Quantize the seconds field, randomizing it as requested.
- Parameters:
cronExpression - the cron expression to (possibly) quantize.randomize - controls the randomization of the seconds fields (null is assumed to mean
CronExpressionQuantizer.Randomize.AS_NEEDED.
- Returns:
- the cron expression with the seconds field forced to a value between
0 and
59 (inclusive) if it is not already in that format or as instructed to by
the randomize option.
Copyright © 2014 Atlassian. All Rights Reserved.