org.apache.felix.ipojo.extender.internal.queue

## Class JobInfoCallable<T>

- java.lang.Object
- - org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable<T>

All Implemented Interfaces:
  java.util.concurrent.Callable<T>, JobInfo

    public class JobInfoCallable<T>
    extends java.lang.Object
    implements java.util.concurrent.Callable<T>, JobInfo

A callable computing job statistics. The job is given as another callable. The statistics are global, so must be used carefully.

### Constructor Summary

Constructors
Constructor and Description
`JobInfoCallable(QueueNotifier queueNotifier, Statistic statistic, Job<T> delegate, Callback<T> callback, java.lang.String description)` Creates the job info callable.

### Method Summary

All Methods Instance Methods Concrete Methods
`T` `call()` Executes the job.
`java.lang.String` `getDescription()` Gets the job description
`long` `getEndTime()` Gets the completion time.
`long` `getEnlistmentTime()` Gets the submission time of the job.
`long` `getExecutionDuration()` Computes the time spent to execute the job (this does not include the waiting).
`java.lang.String` `getJobType()` Gets the job's type identifier.
`long` `getStartTime()` Gets the starting time.
`long` `getWaitDuration()` Computes the time spent in the waiting queue

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### JobInfoCallable

    public JobInfoCallable(QueueNotifier queueNotifier,
                           Statistic statistic,
                           Job<T> delegate,
                           Callback<T> callback,
                           java.lang.String description)

Creates the job info callable.

Parameters:
  `queueNotifier` - notifier for QueueListeners
  `statistic` - the statistics that will be populated
  `delegate` - the real job
  `callback` - the callback notified when the job is completed
  `description` - the job description

### Method Detail

#### call

    public T call()
           throws java.lang.Exception

Executes the job. This method updates the statistics.

Specified by:
  `call` in interface `java.util.concurrent.Callable<T>`
Returns:
  the job result
Throws:
  `java.lang.Exception` - the job execution failed

#### getEnlistmentTime

    public long getEnlistmentTime()

Description copied from interface: `JobInfo`
Gets the submission time of the job.

Specified by:
  `getEnlistmentTime` in interface `JobInfo`
Returns:
  the enlistment date.

#### getStartTime

    public long getStartTime()

Description copied from interface: `JobInfo`
Gets the starting time. This is the date when the job execution starts.

Specified by:
  `getStartTime` in interface `JobInfo`
Returns:
  the job start date.

#### getEndTime

    public long getEndTime()

Description copied from interface: `JobInfo`
Gets the completion time. This is the date when the job execution ends.

Specified by:
  `getEndTime` in interface `JobInfo`
Returns:
  the job completion date.

#### getWaitDuration

    public long getWaitDuration()

Computes the time spent in the waiting queue

Specified by:
  `getWaitDuration` in interface `JobInfo`
Returns:
  the waited time, if the job is still waiting, gets the current waited time

#### getExecutionDuration

    public long getExecutionDuration()

Computes the time spent to execute the job (this does not include the waiting). If the job is not executed yet, or is still executing, -1 is returned

Specified by:
  `getExecutionDuration` in interface `JobInfo`
Returns:
  the execution duration, or -1.

#### getDescription

    public java.lang.String getDescription()

Description copied from interface: `JobInfo`
Gets the job description

Specified by:
  `getDescription` in interface `JobInfo`
Returns:
  the job description

#### getJobType

    public java.lang.String getJobType()

Description copied from interface: `JobInfo`
Gets the job's type identifier. May be `null` if not provided.

Specified by:
  `getJobType` in interface `JobInfo`
Returns:
  job type identifier