private long getEventDelay(Entity entity, String nominalTime)
throws IvoryException {
Date instanceDate = EntityUtil.parseDateUTC(nominalTime);
LateProcess lateProcess = EntityUtil.getLateProcess(entity);
if (lateProcess == null) {
LOG.warn("Late run not applicable for entity:"
+ entity.getEntityType() + "(" + entity.getName() + ")");
return -1;
}
PolicyType latePolicy = lateProcess.getPolicy();
Date cutOffTime = getCutOffTime(entity, nominalTime);
Date now = new Date();
Long wait = null;
if (now.after(cutOffTime)) {
LOG.warn("Feed Cut Off time: "
+ SchemaHelper.formatDateUTC(cutOffTime)
+ " has expired, Late Rerun can not be scheduled");
return -1;
} else {
AbstractRerunPolicy rerunPolicy = RerunPolicyFactory
.getRetryPolicy(latePolicy);
wait = rerunPolicy.getDelay(lateProcess.getDelay(), instanceDate,
cutOffTime);
}
return wait;
}