Class BackgroundJobStatusDecorator<T>

    • Constructor Detail

      • BackgroundJobStatusDecorator

        public BackgroundJobStatusDecorator​(BackgroundJobStatus<T> delegatee)
    • Method Detail

      • getWorkDone

        public int getWorkDone()
        Description copied from interface: BackgroundJobInfo
        Get the amount of work that is already done. Returns the number of "units of work" that have been completed by the job so far. Use BackgroundJobInfo.getWorkTotal() to put this into relation.
        Specified by:
        getWorkDone in interface BackgroundJobInfo
        Returns:
        number of completed "units of work"
      • getWorkTotal

        public int getWorkTotal()
        Description copied from interface: BackgroundJobInfo
        Get the total amount of work.

        Returns the total number of "units of work" comprising this job, including the part that is already done. BackgroundJob -implementations will typically provide a value in an early stage of processing. They are however not obliged to do so, so the expected total amount may not be known yet. In particular, BackgroundJob are allowed to to update this value if new information about the total amount of work to be done becomes available.
        Specified by:
        getWorkTotal in interface BackgroundJobInfo
        Returns:
        the expected total amount of work in "units of work".
      • abort

        public void abort()
        Description copied from interface: BackgroundJobStatus
        Request the cancellation of a job.

        This will try to interrupt the thread executing the job and it will make BackgroundJobMonitor.isAborting() return false. Nevertheless it may take some time until the job actually stops whatever it is doing.
        Specified by:
        abort in interface BackgroundJobStatus<T>
      • getId

        public java.lang.String getId()
        Description copied from interface: BackgroundJobInfo
        The unique identifier assigned to this job by the scheduler.
        Specified by:
        getId in interface BackgroundJobInfo
        Returns:
        the id.
      • join

        public void join​(long timeout)
                  throws java.lang.InterruptedException
        Description copied from interface: BackgroundJobStatus
        Join the thread executing the job.
        Specified by:
        join in interface BackgroundJobStatus<T>
        Parameters:
        timeout - the maximum number of milliseconds to wait for the job.
        Throws:
        java.lang.InterruptedException
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: BackgroundJobInfo
        The human-readable description for this job.
        Specified by:
        getDescription in interface BackgroundJobInfo
        Returns:
        the description.
      • result

        public T result()
                 throws java.lang.InterruptedException,
                        java.util.concurrent.ExecutionException
        Description copied from interface: BackgroundJobStatus
        Obtain the result produced by the job, waiting for its completion if necessary.
        Specified by:
        result in interface BackgroundJobStatus<T>
        Returns:
        the result.
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • getJobClass

        public java.lang.Class<?> getJobClass()
        Description copied from interface: BackgroundJobInfo
        The class implementing the actual work. This will typically be an Implementation of BackgroundJob, but Schedulers may choose a different approach.
        Specified by:
        getJobClass in interface BackgroundJobInfo
        Returns:
        the implementation of the job.
      • getLastModified

        public long getLastModified()
        Specified by:
        getLastModified in interface BackgroundJobInfo
        Returns:
        the last time at which progress info or state where updated. (Milliseconds since epoch.)