public class

CachedScheduledJobDao

extends Object
implements ScheduledJobDao
java.lang.Object
   ↳ com.atlassian.confluence.schedule.persistence.dao.CachedScheduledJobDao

Class Overview

Provides an implementation for storing data used by the ScheduleJobManager. Runtime/transient data is stored into Cache's (either ehcache or coherence caches) for quick access. The caches do not expire, and are sufficiently large not to fill up. There is currently no checking if they are full, and this will cause issues if this occurs. Use of cache's will allow the data to be synchronised across cluster nodes by coherence. Runtime/transient data includes the scheduled job status, and the default cron expressions. Persistent data is stored into Bandana, it's not intended to be used for high-frequency updates. Persistent data includes persisted history (when enabled), and the job configuration (changed cron expression, enabled/disabled flag).

Summary

Public Constructors
CachedScheduledJobDao(Cache scheduledJobStatusCache, BandanaManager bandanaManager)
Public Methods
void addHistory(ScheduledJobKey key, ScheduledJobHistory history, Date nextOccurence, boolean persistHistory)
Adds to an event to the history, and updates the nextOccurence in the ScheduledJobStatus.
ScheduledJobConfiguration getScheduledJobConfiguration(ScheduledJobKey key)
Gets the job configuration for the specified job.
String getScheduledJobDefaultCronExpression(ScheduledJobKey key)
Gets the default cron expression for the job.
List<ScheduledJobHistory> getScheduledJobHistory(ScheduledJobKey key)
The the job history for a specified job.
ScheduledJobStatus getScheduledJobStatus(ScheduledJobKey key)
Gets the specified job's status.
void saveScheduledJobConfiguration(ScheduledJobKey key, ScheduledJobConfiguration job)
Stores the job configuration.
void saveScheduledJobDefaultCronExpression(ScheduledJobKey key, String cronExpressionDefault)
Stores the default cron expression for a job.
void saveScheduledJobStatus(ScheduledJobKey key, ScheduledJobStatus status)
Stores the status for the specified job.
void updateNextOccurence(ScheduledJobKey key, Date nextOccurence)
Updates the nextOccurence in the ScheduledJobStatus.
void updateStatus(ScheduledJobKey key, ExecutionStatus status)
Updates the status in the corresponding ScheduledJobStatus for the job.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.confluence.schedule.persistence.dao.ScheduledJobDao

Public Constructors

public CachedScheduledJobDao (Cache scheduledJobStatusCache, BandanaManager bandanaManager)

Public Methods

public void addHistory (ScheduledJobKey key, ScheduledJobHistory history, Date nextOccurence, boolean persistHistory)

Adds to an event to the history, and updates the nextOccurence in the ScheduledJobStatus.

Parameters
key the job key
history the event that occurred
nextOccurence the date that the job is expected to execute next
persistHistory true the history will be persisted

public ScheduledJobConfiguration getScheduledJobConfiguration (ScheduledJobKey key)

Gets the job configuration for the specified job.

Parameters
key the job key
Returns
  • null if not found.

public String getScheduledJobDefaultCronExpression (ScheduledJobKey key)

Gets the default cron expression for the job.

Parameters
key the job key
Returns
  • null if job not found.

public List<ScheduledJobHistory> getScheduledJobHistory (ScheduledJobKey key)

The the job history for a specified job.

Parameters
key the job key
Returns
  • a list of ScheduledJobHistory. Null if no history has been recorded or persisted.

public ScheduledJobStatus getScheduledJobStatus (ScheduledJobKey key)

Gets the specified job's status.

It's recommended that ScheduleJobStatusManager be used for access to a job's status, rather than this call directly. The manager handles cache expiry automatically.

Parameters
key the job key
Returns
  • null if the job does not exist, or the status has expired from the cache.

public void saveScheduledJobConfiguration (ScheduledJobKey key, ScheduledJobConfiguration job)

Stores the job configuration.

Parameters
key the job key
job the configuration

public void saveScheduledJobDefaultCronExpression (ScheduledJobKey key, String cronExpressionDefault)

Stores the default cron expression for a job.

Parameters
key the job key

public void saveScheduledJobStatus (ScheduledJobKey key, ScheduledJobStatus status)

Stores the status for the specified job.

Parameters
key the job key
status stores the job status.

public void updateNextOccurence (ScheduledJobKey key, Date nextOccurence)

Updates the nextOccurence in the ScheduledJobStatus.

Parameters
key the job key
nextOccurence the date that the job is expected to execute next

public void updateStatus (ScheduledJobKey key, ExecutionStatus status)

Updates the status in the corresponding ScheduledJobStatus for the job. {link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.