urbanairship-core/src/main/java/com/urbanairship/automation/AutomationEngine.java
private void scheduleDelayAlarm(final ScheduleEntry scheduleEntry, long delay) {
        final ScheduleOperation operation = new ScheduleOperation(scheduleEntry.scheduleId, scheduleEntry.group) {
            @Override
            protected void onRun() {
                ScheduleEntry scheduleEntry = dataManager.getScheduleEntry(scheduleId);
                if (scheduleEntry != null && scheduleEntry.getExecutionState() == ScheduleEntry.STATE_TIME_DELAYED) {

                    // Expired
                    if (scheduleEntry.isExpired()) {
                        handleExpiredEntry(scheduleEntry);
                        return;
                    }

                    // Delayed => Preparing
                    scheduleEntry.setExecutionState(ScheduleEntry.STATE_PREPARING_SCHEDULE);
                    dataManager.saveSchedule(scheduleEntry);

                    prepareSchedules(Collections.singletonList(scheduleEntry));
                }
            }
        };

        operation.addOnRun(new Runnable() {
            @Override
            public void run() {
                pendingAlarmOperations.remove(operation);
            }
        });
        pendingAlarmOperations.add(operation);
        scheduler.schedule(delay, operation);
    }
/**
     * Schedules a delay for a schedule entry.
     *
     * @param scheduleEntry The schedule entry.
     * @param delay The delay in milliseconds.
     */
Schedules a delay for a schedule entry.
@param scheduleEntry The schedule entry.
@param delay The delay in milliseconds.
Schedules a delay for a schedule entry . @param scheduleEntry The schedule entry . @param delay The delay in milliseconds .
private void scheduleDelayAlarm(final ScheduleEntry scheduleEntry, long delay) {
        final ScheduleOperation operation = new ScheduleOperation(scheduleEntry.scheduleId, scheduleEntry.group) {
            @Override
            protected void onRun() {
                ScheduleEntry scheduleEntry = dataManager.getScheduleEntry(scheduleId);
                if (scheduleEntry != null && scheduleEntry.getExecutionState() == ScheduleEntry.STATE_TIME_DELAYED) {
                    if (scheduleEntry.isExpired()) {
                        handleExpiredEntry(scheduleEntry);
                        return;
                    }
                    scheduleEntry.setExecutionState(ScheduleEntry.STATE_PREPARING_SCHEDULE);
                    dataManager.saveSchedule(scheduleEntry);
                    prepareSchedules(Collections.singletonList(scheduleEntry));
                }
            }
        };
        operation.addOnRun(new Runnable() {
            @Override
            public void run() {
                pendingAlarmOperations.remove(operation);
            }
        });
        pendingAlarmOperations.add(operation);
        scheduler.schedule(delay, operation);
    }
private void scheduleDelayAlarm ( final ScheduleEntry scheduleEntry , long delay ) { final ScheduleOperation operation = new ScheduleOperation ( scheduleEntry . scheduleId , scheduleEntry . group ) { @ Override protected void onRun ( ) { ScheduleEntry scheduleEntry = dataManager . getScheduleEntry ( scheduleId ) ; if ( scheduleEntry != null && scheduleEntry . getExecutionState ( ) == ScheduleEntry . STATE_TIME_DELAYED ) { if ( scheduleEntry . isExpired ( ) ) { handleExpiredEntry ( scheduleEntry ) ; return ; } scheduleEntry . setExecutionState ( ScheduleEntry . STATE_PREPARING_SCHEDULE ) ; dataManager . saveSchedule ( scheduleEntry ) ; prepareSchedules ( Collections . singletonList ( scheduleEntry ) ) ; } } } ; operation . addOnRun ( new Runnable ( ) { @ Override public void run ( ) { pendingAlarmOperations . remove ( operation ) ; } } ) ; pendingAlarmOperations . add ( operation ) ; scheduler . schedule ( delay , operation ) ; }
Schedules a delay for a schedule entry.
Schedules a delay for a schedule entry .
// Expired // Delayed => Preparing