com.atlassian.confluence.schedule.persistence.dao
Class ClusterSafeScheduledJobDao

java.lang.Object
  extended by com.atlassian.confluence.schedule.persistence.dao.ClusterSafeScheduledJobDao
All Implemented Interfaces:
ScheduledJobDao

@Internal
public class ClusterSafeScheduledJobDao
extends java.lang.Object
implements ScheduledJobDao

Provides a partial implementation of ScheduledJobDao, and is a stripped-down version of CachedScheduledJobDao. The job configuration functions remain intact (using Bandana), but the job status and history functions have been stubbed out due to their non-performant implementations in CachedScheduledJobDao. The job status and history functions, however, have been stubbed out, as their use required a distributed cache for consistentcy, but the performance was poor. Stubbing those functions out is the safer option, even though it effectively means that those functions are not available in the Scheduler Admin UI.

Since:
5.6

Constructor Summary
ClusterSafeScheduledJobDao(com.atlassian.bandana.BandanaManager bandanaManager)
           
 
Method Summary
 void addHistory(ScheduledJobKey key, ScheduledJobHistory history, java.util.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.
 java.lang.String getScheduledJobDefaultCronExpression(ScheduledJobKey key)
          Gets the default cron expression for the job.
 java.util.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, java.lang.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, java.util.Date nextOccurence)
          Updates the nextOccurence in the ScheduledJobStatus.
 void updateStatus(ScheduledJobKey key, ExecutionStatus status)
          Updates the status in the corresponding ScheduledJobStatus for the job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterSafeScheduledJobDao

public ClusterSafeScheduledJobDao(com.atlassian.bandana.BandanaManager bandanaManager)
Method Detail

getScheduledJobStatus

public ScheduledJobStatus getScheduledJobStatus(ScheduledJobKey key)
Description copied from interface: ScheduledJobDao
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.

Specified by:
getScheduledJobStatus in interface ScheduledJobDao
Parameters:
key - the job key
Returns:
null if the job does not exist, or the status has expired from the cache.

saveScheduledJobStatus

public void saveScheduledJobStatus(ScheduledJobKey key,
                                   ScheduledJobStatus status)
Description copied from interface: ScheduledJobDao
Stores the status for the specified job.

Specified by:
saveScheduledJobStatus in interface ScheduledJobDao
Parameters:
key - the job key
status - stores the job status.

updateStatus

public void updateStatus(ScheduledJobKey key,
                         ExecutionStatus status)
Description copied from interface: ScheduledJobDao
Updates the status in the corresponding ScheduledJobStatus for the job. {link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.

Specified by:
updateStatus in interface ScheduledJobDao

addHistory

public void addHistory(ScheduledJobKey key,
                       ScheduledJobHistory history,
                       java.util.Date nextOccurence,
                       boolean persistHistory)
Description copied from interface: ScheduledJobDao
Adds to an event to the history, and updates the nextOccurence in the ScheduledJobStatus.

Specified by:
addHistory in interface ScheduledJobDao
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

updateNextOccurence

public void updateNextOccurence(ScheduledJobKey key,
                                java.util.Date nextOccurence)
Description copied from interface: ScheduledJobDao
Updates the nextOccurence in the ScheduledJobStatus.

Specified by:
updateNextOccurence in interface ScheduledJobDao
Parameters:
key - the job key
nextOccurence - the date that the job is expected to execute next

getScheduledJobHistory

public java.util.List<ScheduledJobHistory> getScheduledJobHistory(ScheduledJobKey key)
Description copied from interface: ScheduledJobDao
The the job history for a specified job.

Specified by:
getScheduledJobHistory in interface ScheduledJobDao
Parameters:
key - the job key
Returns:
a list of ScheduledJobHistory. Null if no history has been recorded or persisted.

saveScheduledJobConfiguration

public void saveScheduledJobConfiguration(ScheduledJobKey key,
                                          ScheduledJobConfiguration job)
Description copied from interface: ScheduledJobDao
Stores the job configuration.

Specified by:
saveScheduledJobConfiguration in interface ScheduledJobDao
Parameters:
key - the job key
job - the configuration

getScheduledJobConfiguration

public ScheduledJobConfiguration getScheduledJobConfiguration(ScheduledJobKey key)
Description copied from interface: ScheduledJobDao
Gets the job configuration for the specified job.

Specified by:
getScheduledJobConfiguration in interface ScheduledJobDao
Parameters:
key - the job key
Returns:
null if not found.

saveScheduledJobDefaultCronExpression

public void saveScheduledJobDefaultCronExpression(ScheduledJobKey key,
                                                  java.lang.String cronExpressionDefault)
Description copied from interface: ScheduledJobDao
Stores the default cron expression for a job.

Specified by:
saveScheduledJobDefaultCronExpression in interface ScheduledJobDao
Parameters:
key - the job key

getScheduledJobDefaultCronExpression

public java.lang.String getScheduledJobDefaultCronExpression(ScheduledJobKey key)
Description copied from interface: ScheduledJobDao
Gets the default cron expression for the job.

Specified by:
getScheduledJobDefaultCronExpression in interface ScheduledJobDao
Parameters:
key - the job key
Returns:
null if job not found.


Copyright © 2003-2014 Atlassian. All Rights Reserved.