/** * Creates a placement constraint that has to be satisfied within a time * window. * * @param constraint the placement constraint * @param delay the length of the time window within which the constraint has * to be satisfied * @param timeUnit the unit of time of the time window * @return the resulting timed placement constraint */ public static TimedPlacementConstraint timedClockConstraint( AbstractConstraint constraint, long delay, TimeUnit timeUnit) { return new TimedPlacementConstraint(constraint, timeUnit.toMillis(delay), TimedPlacementConstraint.DelayUnit.MILLISECONDS); }
/** * Creates a placement constraint that has to be satisfied within a number of * placement opportunities (invocations of the scheduler). * * @param constraint the placement constraint * @param delay the number of scheduling opportunities within which the * constraint has to be satisfied * @return the resulting timed placement constraint */ public static TimedPlacementConstraint timedOpportunitiesConstraint( AbstractConstraint constraint, long delay) { return new TimedPlacementConstraint(constraint, delay, TimedPlacementConstraint.DelayUnit.OPPORTUNITIES); }
private TimedPlacementConstraint convert( TimedPlacementConstraintProto proto) { AbstractConstraint pConstraint = convert(proto.getPlacementConstraint()); return new TimedPlacementConstraint(pConstraint, proto.getSchedulingDelay(), ProtoUtils.convertFromProtoFormat(proto.getDelayUnit())); }