Returns the final time at which the <code>SimpleTrigger</code> will fire, if repeatCount is
REPEAT_INDEFINITELY, null will be returned.

<p>Note that the return time may be in the past.
325871
@Override
  public Date getFinalFireTime() {

    if (repeatCount == 0) {
      return startTime;
    }

    if (repeatCount == REPEAT_INDEFINITELY) {
      return (getEndTime() == null) ? null : getFireTimeBefore(getEndTime());
    }

    long lastTrigger = startTime.getTime() + (repeatCount * repeatInterval);

    if ((getEndTime() == null) || (lastTrigger < getEndTime().getTime())) {
      return new Date(lastTrigger);
    } else {
      return getFireTimeBefore(getEndTime());
    }
  }
434224
@Override
  public TriggerInstance getTriggerInstanceByFlowExecId(final int flowExecId) {
    if (flowExecId == Constants.FAILED_EXEC_ID || flowExecId == Constants.UNASSIGNED_EXEC_ID) {
      return null;
    }
    TriggerInstance triggerInstance = null;
    try {
      final Collection<TriggerInstance> res = this.dbOperator
          .query(SELECT_EXECUTIONS_BY_EXEC_ID,
              new TriggerInstanceHandler(SORT_MODE.SORT_ON_START_TIME_ASC), flowExecId);
      triggerInstance = !res.isEmpty() ? res.iterator().next() : null;
    } catch (final SQLException ex) {
      handleSQLException(ex);
    }
    populateFlowTriggerProperties(triggerInstance);
    return triggerInstance;
  }
296835
public com.google.protobuf.Duration getCheckInterval() {
    return checkInterval_ == null ? com.google.protobuf.Duration.getDefaultInstance() : checkInterval_;
  }
362848
public String getTrigger() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "getTrigger returning " + trigger);
        return this.trigger;
    }
1240274
@Override
    public TriggerPolicy<T> getTriggerPolicy(TriggerHandler triggerHandler, EvictionPolicy<T> evictionPolicy) {
        return new TimeTriggerPolicy<>(windowConfig.getSlidingLength(), triggerHandler, evictionPolicy);
    }
665057
@Override
    public DateTime getEnd() {
        try {
            final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP);
            try {
                return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1()));
            } finally {
                client.close();
            }
        } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) {
            LOG.log(Level.SEVERE, "getEnd RPC call failed", ex);
            throw new RuntimeException("RPC call failed", ex);
        }
    }
437234
@Override
  public OperableTrigger instantiate() {

    SimpleTriggerImpl st = new SimpleTriggerImpl();
    st.setRepeatInterval(interval);
    st.setRepeatCount(repeatCount);
    st.setMisfireInstruction(misfireInstruction);
    return st;
  }
1367787
public Retryer<R> timeout(long duration, TimeUnit timeUnit, ExecutorService executor) {
        return timeout(null == executor
                ? new SimpleTimeLimiter() : new SimpleTimeLimiter(executor), duration, timeUnit);
    }
160890
@Override
  @Nonnull
  public SimpleTrigger build ()
  {
    final SimpleTrigger ret = new SimpleTrigger ();
    ret.setRepeatInterval (m_nInterval);
    ret.setRepeatCount (m_nRepeatCount);
    ret.setMisfireInstruction (m_nMisfireInstruction);
    return ret;
  }
881393
public AttemptTimelimit<R> getTimelimiter() {
        return this.tryTimeout = (null == this.tryTimeout ? new AttemptTimelimit<R>() {
            //An implementation which actually does not attempt to limit time at all
            @Override public R call(Callable<R> callable) throws Exception {
                return checkNotNull(callable).call();
            }
        } : this.tryTimeout);
    }
80840
@Override
  public TriggerInstance getTriggerInstanceById(final String triggerInstanceId) {
    TriggerInstance triggerInstance = null;
    try {
      final Collection<TriggerInstance> res = this.dbOperator
          .query(SELECT_EXECUTIONS_BY_INSTANCE_ID,
              new TriggerInstanceHandler(SORT_MODE.SORT_ON_START_TIME_ASC),
              triggerInstanceId);
      triggerInstance = !res.isEmpty() ? res.iterator().next() : null;
    } catch (final SQLException ex) {
      handleSQLException(ex);
    }
    populateFlowTriggerProperties(triggerInstance);
    return triggerInstance;
  }
142288
T getClosedFiniteEnd() {

        T temporal = this.end.getTemporal();

        if ((temporal != null) && this.end.isOpen()) {
            return this.getTimeLine().stepBackwards(temporal);
        } else {
            return temporal;
        }

    }
988641
@Override
    public final long getUniqueTickCount() throws PersistenceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getUniqueTickCount");

        if (_tickCountGenerator != null)
        {
            long key = AbstractItem.NO_ID;

            key = _tickCountGenerator.getUniqueValue();

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getUniqueTickCount", Long.valueOf(key));
            return key;
        }
        else
        {
            MessageStoreUnavailableException msue;
            if (!_startupExceptions.isEmpty())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Operation not possible as MessageStore failed to start!");
                msue = new MessageStoreUnavailableException("Operation not possible as MessageStore failed to start!", _startupExceptions.get(0));
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Operation not possible as MessageStore is unavailable!");
                msue = new MessageStoreUnavailableException("Operation not possible as MessageStore is unavailable!");
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getUniqueTickCount");
            throw msue;
        }
    }
800171
@Override
    public void pauseTrigger(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException {
        final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
        Boolean exists = jedis.exists(triggerHashKey);
        Double completedScore = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.COMPLETED), triggerHashKey);
        String nextFireTimeResponse = jedis.hget(triggerHashKey, TRIGGER_NEXT_FIRE_TIME);
        Double blockedScore = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.BLOCKED), triggerHashKey);

        if (!exists) {
            return;
        }
        if (completedScore != null) {
            // doesn't make sense to pause a completed trigger
            return;
        }

        final long nextFireTime = nextFireTimeResponse == null
                || nextFireTimeResponse.isEmpty() ? -1 : Long.parseLong(nextFireTimeResponse);
        if (blockedScore != null) {
            setTriggerState(RedisTriggerState.PAUSED_BLOCKED, (double) nextFireTime, triggerHashKey, jedis);
        } else {
            setTriggerState(RedisTriggerState.PAUSED, (double) nextFireTime, triggerHashKey, jedis);
        }
    }
729211
@Override
  public Date getFireTimeAfter(Date afterTime) {

    if (complete) {
      return null;
    }

    if ((timesTriggered > repeatCount) && (repeatCount != REPEAT_INDEFINITELY)) {
      return null;
    }

    if (afterTime == null) {
      afterTime = new Date();
    }

    if (repeatCount == 0 && afterTime.compareTo(getStartTime()) >= 0) {
      return null;
    }

    long startMillis = getStartTime().getTime();
    long afterMillis = afterTime.getTime();
    long endMillis = (getEndTime() == null) ? Long.MAX_VALUE : getEndTime().getTime();

    if (endMillis <= afterMillis) {
      return null;
    }

    if (afterMillis < startMillis) {
      return new Date(startMillis);
    }

    long numberOfTimesExecuted = ((afterMillis - startMillis) / repeatInterval) + 1;

    if ((numberOfTimesExecuted > repeatCount) && (repeatCount != REPEAT_INDEFINITELY)) {
      return null;
    }

    Date time = new Date(startMillis + (numberOfTimesExecuted * repeatInterval));

    if (endMillis <= time.getTime()) {
      return null;
    }

    return time;
  }
68231
private Date getFireTimeBefore(Date end) {

    if (end.getTime() < getStartTime().getTime()) {
      return null;
    }

    int numFires = computeNumTimesFiredBetween(getStartTime(), end);

    return new Date(getStartTime().getTime() + (numFires * repeatInterval));
  }
602035
@Override
    public Collection<String> resumeTriggers(GroupMatcher<TriggerKey> matcher, JedisCluster jedis) throws JobPersistenceException {
        Set<String> resumedTriggerGroups = new HashSet<>();
        if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) {
            final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue()));
            jedis.srem(redisSchema.pausedJobGroupsSet(), triggerGroupSetKey);
            Set<String> triggerHashKeysResponse = jedis.smembers(triggerGroupSetKey);
            for (String triggerHashKey : triggerHashKeysResponse) {
                OperableTrigger trigger = retrieveTrigger(redisSchema.triggerKey(triggerHashKey), jedis);
                resumeTrigger(trigger.getKey(), jedis);
                resumedTriggerGroups.add(trigger.getKey().getGroup());
            }
        } else {
            for (final String triggerGroupSetKey : jedis.smembers(redisSchema.triggerGroupsSet())) {
                if (matcher.getCompareWithOperator().evaluate(redisSchema.triggerGroup(triggerGroupSetKey), matcher.getCompareToValue())) {
                    resumedTriggerGroups.addAll(resumeTriggers(GroupMatcher.triggerGroupEquals(redisSchema.triggerGroup(triggerGroupSetKey)), jedis));
                }
            }
        }
        return resumedTriggerGroups;
    }