Package rx

Class Scheduler.Worker

    • Constructor Detail

      • Worker

        public Worker()
    • Method Detail

      • schedule

        public abstract Subscription schedule​(Action0 action)
        Schedules an Action for execution.
        Parameters:
        action - Action to schedule
        Returns:
        a subscription to be able to unsubscribe the action (unschedule it if not executed)
      • schedule

        public abstract Subscription schedule​(Action0 action,
                                              long delayTime,
                                              java.util.concurrent.TimeUnit unit)
        Schedules an Action for execution at some point in the future.

        Note to implementors: non-positive delayTime should be regarded as undelayed schedule, i.e., as if the schedule(rx.functions.Action0) was called.

        Parameters:
        action - the Action to schedule
        delayTime - time to wait before executing the action; non-positive values indicate an undelayed schedule
        unit - the time unit of delayTime
        Returns:
        a subscription to be able to unsubscribe the action (unschedule it if not executed)
      • schedulePeriodically

        public Subscription schedulePeriodically​(Action0 action,
                                                 long initialDelay,
                                                 long period,
                                                 java.util.concurrent.TimeUnit unit)
        Schedules a cancelable action to be executed periodically. This default implementation schedules recursively and waits for actions to complete (instead of potentially executing long-running actions concurrently). Each scheduler that can do periodic scheduling in a better way should override this.

        Note to implementors: non-positive initialTime and period should be regarded as undelayed scheduling of the first and any subsequent executions.

        Parameters:
        action - the Action to execute periodically
        initialDelay - time to wait before executing the action for the first time; non-positive values indicate an undelayed schedule
        period - the time interval to wait each time in between executing the action; non-positive values indicate no delay between repeated schedules
        unit - the time unit of period
        Returns:
        a subscription to be able to unsubscribe the action (unschedule it if not executed)
      • now

        public long now()
        Gets the current time, in milliseconds, according to this Scheduler.
        Returns:
        the scheduler's notion of current absolute time in milliseconds