Interface SchedulerRepository

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean insertTask​(Task task)
      Save task on database
      boolean insertTask​(Task task, boolean picked, java.lang.String server)
      Save task on database
      java.util.List<Task> loadTasksToRun​(java.lang.String server, long pollingInterval)
      Load tasks to run
      boolean updateNotRunnedTask​(java.lang.String server)
      Update not runned tasks to make them available to be picked by another servers
      boolean updateRecurringTask​(RecurringTask task, boolean picked, java.lang.String pickedBy)
      Update recurring task data after run This update running fields to put task available to run another time Changed fields: picked = false, picked_by = null and end_run = null
      boolean updateTask​(java.lang.String key, java.time.Instant end)
      Update task data after run
    • Method Detail

      • insertTask

        boolean insertTask​(Task task)
                    throws DatabaseException
        Save task on database
        Parameters:
        task - to save on database
        Returns:
        result of operation
        Throws:
        DatabaseException - thrown when database not configured well
      • insertTask

        boolean insertTask​(Task task,
                           boolean picked,
                           java.lang.String server)
                    throws DatabaseException
        Save task on database
        Parameters:
        task - to save on database
        picked - boolean with picked status
        server - is the name/identifier of server
        Returns:
        result of operation
        Throws:
        DatabaseException - thrown when database not configured well
      • loadTasksToRun

        java.util.List<Task> loadTasksToRun​(java.lang.String server,
                                            long pollingInterval)
                                     throws DatabaseException
        Load tasks to run
        Parameters:
        server - identifier
        pollingInterval - interval in milliseconds to pull tasks
        Returns:
        list of tasks to run
        Throws:
        DatabaseException - exception thrown when database no configured well
      • updateTask

        boolean updateTask​(java.lang.String key,
                           java.time.Instant end)
                    throws DatabaseException
        Update task data after run
        Parameters:
        key - task identifier
        end - time
        Returns:
        result of operation
        Throws:
        DatabaseException - thrown when database not configured well
      • updateRecurringTask

        boolean updateRecurringTask​(RecurringTask task,
                                    boolean picked,
                                    java.lang.String pickedBy)
                             throws DatabaseException
        Update recurring task data after run This update running fields to put task available to run another time Changed fields: picked = false, picked_by = null and end_run = null
        Parameters:
        task - to update
        picked - if task was picked by this instance
        pickedBy - server name
        Returns:
        result of operation
        Throws:
        DatabaseException - thrown when database not configured well
      • updateNotRunnedTask

        boolean updateNotRunnedTask​(java.lang.String server)
                             throws DatabaseException
        Update not runned tasks to make them available to be picked by another servers
        Parameters:
        server - identifier
        Returns:
        result of operation
        Throws:
        DatabaseException - thrown when database not configured well