public class CachedScheduledJobDao extends Object implements ScheduledJobDao
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).
Constructor and Description |
---|
CachedScheduledJobDao(com.atlassian.cache.Cache scheduledJobStatusCache,
com.atlassian.bandana.BandanaManager bandanaManager)
Deprecated.
since 5.10 Use
CachedScheduledJobDao(VCacheFactory, BandanaManager) |
CachedScheduledJobDao(com.atlassian.vcache.VCacheFactory vCacheFactory,
com.atlassian.bandana.BandanaManager bandanaManager) |
Modifier and Type | Method and Description |
---|---|
void |
addHistory(ScheduledJobKey key,
@Nullable ScheduledJobHistory history,
Date nextOccurrence)
Adds to an event to the history to the cache, and updates the nextOccurrence in the ScheduledJobStatus.
|
@Nullable ScheduledJobConfiguration |
getScheduledJobConfiguration(ScheduledJobKey key)
Gets the job configuration for the specified job.
|
@Nullable ScheduledJobStatus |
getScheduledJobStatus(ScheduledJobKey key)
Gets the specified job's status.
|
void |
saveScheduledJobConfiguration(ScheduledJobKey key,
ScheduledJobConfiguration job)
Stores the job configuration.
|
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.
|
@Deprecated public CachedScheduledJobDao(com.atlassian.cache.Cache scheduledJobStatusCache, com.atlassian.bandana.BandanaManager bandanaManager)
CachedScheduledJobDao(VCacheFactory, BandanaManager)
public CachedScheduledJobDao(com.atlassian.vcache.VCacheFactory vCacheFactory, com.atlassian.bandana.BandanaManager bandanaManager)
public @Nullable ScheduledJobStatus getScheduledJobStatus(ScheduledJobKey key)
ScheduledJobDao
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.
getScheduledJobStatus
in interface ScheduledJobDao
key
- the job keypublic void saveScheduledJobStatus(ScheduledJobKey key, ScheduledJobStatus status)
ScheduledJobDao
saveScheduledJobStatus
in interface ScheduledJobDao
key
- the job keystatus
- stores the job status.public void addHistory(ScheduledJobKey key, @Nullable ScheduledJobHistory history, Date nextOccurrence)
ScheduledJobDao
addHistory
in interface ScheduledJobDao
key
- the job keyhistory
- the event that occurrednextOccurrence
- the date that the job is expected to execute nextpublic void updateStatus(ScheduledJobKey key, ExecutionStatus status)
ScheduledJobDao
{link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.
updateStatus
in interface ScheduledJobDao
public void updateNextOccurence(ScheduledJobKey key, Date nextOccurence)
ScheduledJobDao
updateNextOccurence
in interface ScheduledJobDao
key
- the job keynextOccurence
- the date that the job is expected to execute nextpublic void saveScheduledJobConfiguration(ScheduledJobKey key, ScheduledJobConfiguration job)
ScheduledJobDao
saveScheduledJobConfiguration
in interface ScheduledJobDao
key
- the job keyjob
- the configurationpublic @Nullable ScheduledJobConfiguration getScheduledJobConfiguration(ScheduledJobKey key)
ScheduledJobDao
getScheduledJobConfiguration
in interface ScheduledJobDao
key
- the job keyCopyright © 2003–2019 Atlassian. All rights reserved.