urbanairship-core/src/main/java/com/urbanairship/automation/AutomationEngine.java
@WorkerThread
    private void handleTriggeredSchedules(final List<ScheduleEntry> scheduleEntries) {
        if (isPaused.get() || scheduleEntries.isEmpty()) {
            return;
        }

        final HashSet<ScheduleEntry> schedulesToUpdate = new HashSet<>();
        final HashSet<ScheduleEntry> expiredSchedules = new HashSet<>();
        final List<ScheduleEntry> schedulesToPrepare = new ArrayList<>();

        for (final ScheduleEntry scheduleEntry : scheduleEntries) {
            if (scheduleEntry.getExecutionState() != ScheduleEntry.STATE_IDLE) {
                continue;
            }

            schedulesToUpdate.add(scheduleEntry);

            // Expired schedules
            if (scheduleEntry.isExpired()) {
                expiredSchedules.add(scheduleEntry);
                continue;
            }

            // Reset cancellation triggers
            for (TriggerEntry triggerEntry : scheduleEntry.triggerEntries) {
                if (triggerEntry.isCancellation) {
                    triggerEntry.setProgress(0);
                }
            }

            // Check for delays
            if (scheduleEntry.seconds > 0) {
                scheduleEntry.setExecutionState(ScheduleEntry.STATE_TIME_DELAYED);
                scheduleEntry.setDelayFinishDate(TimeUnit.SECONDS.toMillis(scheduleEntry.seconds) + System.currentTimeMillis());
                scheduleDelayAlarm(scheduleEntry, TimeUnit.SECONDS.toMillis(scheduleEntry.seconds));
                continue;
            }

            // IDLE -> PREPARE
            scheduleEntry.setExecutionState(ScheduleEntry.STATE_PREPARING_SCHEDULE);
            schedulesToPrepare.add(scheduleEntry);
        }

        dataManager.saveSchedules(schedulesToUpdate);
        prepareSchedules(schedulesToPrepare);
        handleExpiredEntries(expiredSchedules);
    }
/**
     * Processes a list of triggered schedule entries.
     *
     * @param scheduleEntries A list of triggered schedule entries.
     */
Processes a list of triggered schedule entries.
@param scheduleEntries A list of triggered schedule entries.
Processes a list of triggered schedule entries . @param scheduleEntries A list of triggered schedule entries .
@WorkerThread
    private void handleTriggeredSchedules(final List<ScheduleEntry> scheduleEntries) {
        if (isPaused.get() || scheduleEntries.isEmpty()) {
            return;
        }
        final HashSet<ScheduleEntry> schedulesToUpdate = new HashSet<>();
        final HashSet<ScheduleEntry> expiredSchedules = new HashSet<>();
        final List<ScheduleEntry> schedulesToPrepare = new ArrayList<>();
        for (final ScheduleEntry scheduleEntry : scheduleEntries) {
            if (scheduleEntry.getExecutionState() != ScheduleEntry.STATE_IDLE) {
                continue;
            }
            schedulesToUpdate.add(scheduleEntry);
            if (scheduleEntry.isExpired()) {
                expiredSchedules.add(scheduleEntry);
                continue;
            }
            for (TriggerEntry triggerEntry : scheduleEntry.triggerEntries) {
                if (triggerEntry.isCancellation) {
                    triggerEntry.setProgress(0);
                }
            }
            if (scheduleEntry.seconds > 0) {
                scheduleEntry.setExecutionState(ScheduleEntry.STATE_TIME_DELAYED);
                scheduleEntry.setDelayFinishDate(TimeUnit.SECONDS.toMillis(scheduleEntry.seconds) + System.currentTimeMillis());
                scheduleDelayAlarm(scheduleEntry, TimeUnit.SECONDS.toMillis(scheduleEntry.seconds));
                continue;
            }
            scheduleEntry.setExecutionState(ScheduleEntry.STATE_PREPARING_SCHEDULE);
            schedulesToPrepare.add(scheduleEntry);
        }
        dataManager.saveSchedules(schedulesToUpdate);
        prepareSchedules(schedulesToPrepare);
        handleExpiredEntries(expiredSchedules);
    }
@ WorkerThread private void handleTriggeredSchedules ( final List < ScheduleEntry > scheduleEntries ) { if ( isPaused . get ( ) || scheduleEntries . isEmpty ( ) ) { return ; } final HashSet < ScheduleEntry > schedulesToUpdate = new HashSet < > ( ) ; final HashSet < ScheduleEntry > expiredSchedules = new HashSet < > ( ) ; final List < ScheduleEntry > schedulesToPrepare = new ArrayList < > ( ) ; for ( final ScheduleEntry scheduleEntry : scheduleEntries ) { if ( scheduleEntry . getExecutionState ( ) != ScheduleEntry . STATE_IDLE ) { continue ; } schedulesToUpdate . add ( scheduleEntry ) ; if ( scheduleEntry . isExpired ( ) ) { expiredSchedules . add ( scheduleEntry ) ; continue ; } for ( TriggerEntry triggerEntry : scheduleEntry . triggerEntries ) { if ( triggerEntry . isCancellation ) { triggerEntry . setProgress ( 0 ) ; } } if ( scheduleEntry . seconds > 0 ) { scheduleEntry . setExecutionState ( ScheduleEntry . STATE_TIME_DELAYED ) ; scheduleEntry . setDelayFinishDate ( TimeUnit . SECONDS . toMillis ( scheduleEntry . seconds ) + System . currentTimeMillis ( ) ) ; scheduleDelayAlarm ( scheduleEntry , TimeUnit . SECONDS . toMillis ( scheduleEntry . seconds ) ) ; continue ; } scheduleEntry . setExecutionState ( ScheduleEntry . STATE_PREPARING_SCHEDULE ) ; schedulesToPrepare . add ( scheduleEntry ) ; } dataManager . saveSchedules ( schedulesToUpdate ) ; prepareSchedules ( schedulesToPrepare ) ; handleExpiredEntries ( expiredSchedules ) ; }
Processes a list of triggered schedule entries.
Processes a list of triggered schedule entries .
// Expired schedules // Reset cancellation triggers // Check for delays // IDLE -> PREPARE