Search in sources :

Example 1 with ExecutionPlanImpl

use of lucee.runtime.spooler.ExecutionPlanImpl in project Lucee by lucee.

the class ThreadTag method toExecutionPlan.

private ExecutionPlan toExecutionPlan(Object obj, int plus) throws PageException {
    if (obj instanceof Struct) {
        Struct sct = (Struct) obj;
        // GERT
        // tries
        Object oTries = sct.get(KeyConstants._tries, null);
        if (oTries == null)
            throw new ExpressionException("missing key tries inside struct");
        int tries = Caster.toIntValue(oTries);
        if (tries < 0)
            throw new ExpressionException("tries must contain a none negative value");
        // interval
        Object oInterval = sct.get(KeyConstants._interval, null);
        if (oInterval == null)
            oInterval = sct.get(KeyConstants._intervall, null);
        if (oInterval == null)
            throw new ExpressionException("missing key interval inside struct");
        int interval = toSeconds(oInterval);
        if (interval < 0)
            throw new ExpressionException("interval should contain a positive value or 0");
        return new ExecutionPlanImpl(tries + plus, interval);
    }
    return new ExecutionPlanImpl(1 + plus, toSeconds(obj));
}
Also used : ExecutionPlanImpl(lucee.runtime.spooler.ExecutionPlanImpl) ExpressionException(lucee.runtime.exp.ExpressionException) Struct(lucee.runtime.type.Struct)

Aggregations

ExpressionException (lucee.runtime.exp.ExpressionException)1 ExecutionPlanImpl (lucee.runtime.spooler.ExecutionPlanImpl)1 Struct (lucee.runtime.type.Struct)1