com.atlassian.scheduler.core.status
Class LazyJobDetails

java.lang.Object
  extended by com.atlassian.scheduler.core.status.AbstractJobDetails
      extended by com.atlassian.scheduler.core.status.LazyJobDetails
All Implemented Interfaces:
JobDetails

public class LazyJobDetails
extends AbstractJobDetails

A job details implementation that waits until the first request to one of the methods that needs to know the state of the parameters map before trying to deserialize it. SchedulerService implementations are encouraged to prefer this implementation when returning multiple JobDetails objects, as the deserialization is unnecessary if the caller is not going to use those values.

Since:
v1.0

Field Summary
 
Fields inherited from class com.atlassian.scheduler.core.status.AbstractJobDetails
jobId, jobRunnerKey, runMode, schedule
 
Constructor Summary
LazyJobDetails(JobId jobId, JobRunnerKey jobRunnerKey, RunMode runMode, Schedule schedule, Date nextRunTime, JobRunner jobRunner, byte[] parameters)
          Creates a lazy job details representation.
 
Method Summary
protected  void appendToStringDetails(StringBuilder sb)
           
 Map<String,Serializable> getParameters()
          Returns the configured runtime parameters for this job.
 boolean isRunnable()
          Returns true if this job could be successfully run at this time.
 
Methods inherited from class com.atlassian.scheduler.core.status.AbstractJobDetails
getJobId, getJobRunnerKey, getNextRunTime, getRawParameters, getRunMode, getSchedule, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LazyJobDetails

public LazyJobDetails(@Nonnull
                      JobId jobId,
                      @Nonnull
                      JobRunnerKey jobRunnerKey,
                      @Nonnull
                      RunMode runMode,
                      @Nonnull
                      Schedule schedule,
                      @Nullable
                      Date nextRunTime,
                      @Nonnull
                      JobRunner jobRunner,
                      @Nullable
                      byte[] parameters)
Creates a lazy job details representation.

WARNING: For efficiency reasons, byte[] parameters is not copied.

Parameters:
jobId - the job's ID
jobRunnerKey - the job runner's key
runMode - the running mode of the job
schedule - the job's schedule
nextRunTime - the next run time for the job, if known
jobRunner - the resolved job runner
parameters - the parameters map in serialized form. For efficiency reasons, this constructor uses the original array directly without making a safe copy.
Method Detail

getParameters

@Nonnull
public Map<String,Serializable> getParameters()
Description copied from interface: JobDetails
Returns the configured runtime parameters for this job.

WARNING: If this job was created by a plugin that is not currently active, then it may not actually be possible to access the job's parameters, and this method will throw a SchedulerRuntimeException. Callers are encouraged to first call the JobDetails.isRunnable() method, as a false return value from that method usually guarantees that this method will fail.

Returns:
the configured runtime parameters for this job.

isRunnable

public boolean isRunnable()
Description copied from interface: JobDetails
Returns true if this job could be successfully run at this time. This requires it to have a registered JobRunner whose class loader can successfully reconstruct the job's parameter map.

Returns:
true if this job is currently runnable; false otherwise

appendToStringDetails

protected void appendToStringDetails(StringBuilder sb)
Specified by:
appendToStringDetails in class AbstractJobDetails


Copyright © 2014 Atlassian. All Rights Reserved.