Package org.jobrunr.storage
Class InMemoryStorageProvider
- java.lang.Object
-
- org.jobrunr.storage.AbstractStorageProvider
-
- org.jobrunr.storage.InMemoryStorageProvider
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,StorageProvider
public class InMemoryStorageProvider extends AbstractStorageProvider
-
-
Field Summary
-
Fields inherited from interface org.jobrunr.storage.StorageProvider
BATCH_SIZE
-
-
Constructor Summary
Constructors Constructor Description InMemoryStorageProvider()
InMemoryStorageProvider(RateLimiter rateLimiter)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
announceBackgroundJobServer(BackgroundJobServerStatus serverStatus)
long
countRecurringJobs()
Deprecated.int
deleteJobsPermanently(StateName state, java.time.Instant updatedBefore)
void
deleteMetadata(java.lang.String key)
int
deletePermanently(java.util.UUID id)
int
deleteRecurringJob(java.lang.String id)
boolean
exists(JobDetails jobDetails, StateName... states)
java.util.List<BackgroundJobServerStatus>
getBackgroundJobServers()
java.util.Set<java.lang.String>
getDistinctJobSignatures(StateName... states)
Job
getJobById(java.util.UUID id)
Page<Job>
getJobPage(StateName state, PageRequest pageRequest)
java.util.List<Job>
getJobs(StateName state, java.time.Instant updatedBefore, PageRequest pageRequest)
java.util.List<Job>
getJobs(StateName state, PageRequest pageRequest)
JobStats
getJobStats()
java.util.UUID
getLongestRunningBackgroundJobServerId()
java.util.List<JobRunrMetadata>
getMetadata(java.lang.String key)
JobRunrMetadata
getMetadata(java.lang.String key, java.lang.String owner)
RecurringJobsResult
getRecurringJobs()
java.util.List<Job>
getScheduledJobs(java.time.Instant scheduledBefore, PageRequest pageRequest)
void
publishTotalAmountOfSucceededJobs(int amount)
boolean
recurringJobExists(java.lang.String recurringJobId, StateName... states)
boolean
recurringJobsUpdated(java.lang.Long recurringJobsUpdatedHash)
int
removeTimedOutBackgroundJobServers(java.time.Instant heartbeatOlderThan)
java.util.List<Job>
save(java.util.List<Job> jobs)
Job
save(Job job)
void
saveMetadata(JobRunrMetadata metadata)
RecurringJob
saveRecurringJob(RecurringJob recurringJob)
void
setJobMapper(JobMapper jobMapper)
void
setUpStorageProvider(StorageProviderUtils.DatabaseOptions databaseOptions)
This method allows to reinitialize the StorageProvider.boolean
signalBackgroundJobServerAlive(BackgroundJobServerStatus serverStatus)
void
signalBackgroundJobServerStopped(BackgroundJobServerStatus serverStatus)
-
Methods inherited from class org.jobrunr.storage.AbstractStorageProvider
addJobStorageOnChangeListener, close, getName, notifyJobStatsOnChangeListeners, notifyJobStatsOnChangeListenersIf, notifyMetadataChangeListeners, notifyMetadataChangeListeners, removeJobStorageOnChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jobrunr.storage.StorageProvider
getJobById
-
-
-
-
Constructor Detail
-
InMemoryStorageProvider
public InMemoryStorageProvider()
-
InMemoryStorageProvider
public InMemoryStorageProvider(RateLimiter rateLimiter)
-
-
Method Detail
-
setJobMapper
public void setJobMapper(JobMapper jobMapper)
-
setUpStorageProvider
public void setUpStorageProvider(StorageProviderUtils.DatabaseOptions databaseOptions)
Description copied from interface:StorageProvider
This method allows to reinitialize the StorageProvider. It can be used if you are using Flyway or Liquibase to setup your database manually. By default, this method is automatically called on construction of the StorageProvider- Parameters:
databaseOptions
- defines whether to set up the StorageProvider or validate whether the StorageProvider is set up correctly.
-
announceBackgroundJobServer
public void announceBackgroundJobServer(BackgroundJobServerStatus serverStatus)
-
signalBackgroundJobServerAlive
public boolean signalBackgroundJobServerAlive(BackgroundJobServerStatus serverStatus)
-
signalBackgroundJobServerStopped
public void signalBackgroundJobServerStopped(BackgroundJobServerStatus serverStatus)
-
getBackgroundJobServers
public java.util.List<BackgroundJobServerStatus> getBackgroundJobServers()
-
getLongestRunningBackgroundJobServerId
public java.util.UUID getLongestRunningBackgroundJobServerId()
-
removeTimedOutBackgroundJobServers
public int removeTimedOutBackgroundJobServers(java.time.Instant heartbeatOlderThan)
-
getJobById
public Job getJobById(java.util.UUID id)
-
saveMetadata
public void saveMetadata(JobRunrMetadata metadata)
-
getMetadata
public java.util.List<JobRunrMetadata> getMetadata(java.lang.String key)
-
getMetadata
public JobRunrMetadata getMetadata(java.lang.String key, java.lang.String owner)
-
deleteMetadata
public void deleteMetadata(java.lang.String key)
-
deletePermanently
public int deletePermanently(java.util.UUID id)
-
getJobs
public java.util.List<Job> getJobs(StateName state, java.time.Instant updatedBefore, PageRequest pageRequest)
-
getScheduledJobs
public java.util.List<Job> getScheduledJobs(java.time.Instant scheduledBefore, PageRequest pageRequest)
-
getJobs
public java.util.List<Job> getJobs(StateName state, PageRequest pageRequest)
-
getJobPage
public Page<Job> getJobPage(StateName state, PageRequest pageRequest)
-
deleteJobsPermanently
public int deleteJobsPermanently(StateName state, java.time.Instant updatedBefore)
-
getDistinctJobSignatures
public java.util.Set<java.lang.String> getDistinctJobSignatures(StateName... states)
-
exists
public boolean exists(JobDetails jobDetails, StateName... states)
-
recurringJobExists
public boolean recurringJobExists(java.lang.String recurringJobId, StateName... states)
-
saveRecurringJob
public RecurringJob saveRecurringJob(RecurringJob recurringJob)
-
getRecurringJobs
public RecurringJobsResult getRecurringJobs()
-
countRecurringJobs
@Deprecated public long countRecurringJobs()
Deprecated.
-
recurringJobsUpdated
public boolean recurringJobsUpdated(java.lang.Long recurringJobsUpdatedHash)
-
deleteRecurringJob
public int deleteRecurringJob(java.lang.String id)
-
getJobStats
public JobStats getJobStats()
-
publishTotalAmountOfSucceededJobs
public void publishTotalAmountOfSucceededJobs(int amount)
-
-