Class SchedulerImpl

  • All Implemented Interfaces:
    Scheduler

    public class SchedulerImpl
    extends Object
    implements Scheduler
    Default command scheduler implementation.
    Author:
    Jiri Bubnik
    • Constructor Detail

      • SchedulerImpl

        public SchedulerImpl()
    • Method Detail

      • scheduleCommand

        public void scheduleCommand​(Command command)
        Description copied from interface: Scheduler
        Schedule new command for execution.

        If the command (or another same instance by equals) is already scheduled, then the old instance is replaced by this command and timer is restarted.

        The command contains information about target classloader where it should be run.

        The default timeout 100ms is assumed. If another (equals) command is scheduled before the timeout expires, it replaced (or merged). Otherwise the command is executed at timeout.

        Specified by:
        scheduleCommand in interface Scheduler
        Parameters:
        command - the command to execute
      • scheduleCommand

        public void scheduleCommand​(Command command,
                                    int timeout)
        Description copied from interface: Scheduler
        Schedule new command for execution.

        Specified by:
        scheduleCommand in interface Scheduler
        Parameters:
        command - the command to execute
        timeout - timeout after which the command is executed
      • scheduleCommand

        public void scheduleCommand​(Command command,
                                    int timeout,
                                    Scheduler.DuplicateSheduleBehaviour behaviour)
        Description copied from interface: Scheduler
        Schedule new command for execution.

        Specified by:
        scheduleCommand in interface Scheduler
        Parameters:
        command - the command to execute
        timeout - timeout after which the command is executed
        behaviour - if another instance of this commands runs on schedule or within timeout, should we skip it?
      • run

        public void run()
        Description copied from interface: Scheduler
        Run the scheduler agent thread.
        Specified by:
        run in interface Scheduler
      • stop

        public void stop()
        Description copied from interface: Scheduler
        Stop the scheduler agent thread.
        Specified by:
        stop in interface Scheduler