Interface JobResultStore
-
- All Known Implementing Classes:
AbstractThreadsafeJobResultStore
,EmbeddedJobResultStore
,FileSystemJobResultStore
@Internal public interface JobResultStore
A storage for the results of globally terminated jobs. These results can have the following states:dirty
- indicating that the corresponding job is not properly cleaned up, yet.clean
- indicating that the cleanup of the corresponding job is performed and no further actions need to be applied.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletableFuture<Void>
createDirtyResultAsync(JobResultEntry jobResultEntry)
Registers the passedJobResultEntry
instance asdirty
which indicates that clean-up operations still need to be performed.Set<JobResult>
getDirtyResults()
Get the persistedJobResult
instances that are marked asdirty
.CompletableFuture<Boolean>
hasCleanJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains aclean
entry for the givenJobID
.CompletableFuture<Boolean>
hasDirtyJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains adirty
entry for the givenJobID
.default CompletableFuture<Boolean>
hasJobResultEntryAsync(JobID jobId)
Returns the future of whether the store already contains an entry for a job.CompletableFuture<Void>
markResultAsCleanAsync(JobID jobId)
Marks an existingJobResultEntry
asclean
.
-
-
-
Method Detail
-
createDirtyResultAsync
CompletableFuture<Void> createDirtyResultAsync(JobResultEntry jobResultEntry)
Registers the passedJobResultEntry
instance asdirty
which indicates that clean-up operations still need to be performed. Once the job resource cleanup has been finalized, we can mark theJobResultEntry
asclean
result usingmarkResultAsCleanAsync(JobID)
.- Parameters:
jobResultEntry
- The job result we wish to persist.- Returns:
- a successfully completed future if the dirty result is created successfully. The
future will be completed with
IllegalStateException
if the passedjobResultEntry
has aJobID
attached that is already registered in thisJobResultStore
.
-
markResultAsCleanAsync
CompletableFuture<Void> markResultAsCleanAsync(JobID jobId)
Marks an existingJobResultEntry
asclean
. This indicates that no more resource cleanup steps need to be performed. No actions should be triggered if the passedJobID
belongs to a job that was already marked as clean.- Parameters:
jobId
- Ident of the job we wish to mark as clean.- Returns:
- a successfully completed future if the result is marked successfully. The future can
complete exceptionally with a
NoSuchElementException
. i.e. there is no correspondingdirty
job present in the store for the givenJobID
.
-
hasJobResultEntryAsync
default CompletableFuture<Boolean> hasJobResultEntryAsync(JobID jobId)
Returns the future of whether the store already contains an entry for a job.- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
if adirty
orclean
JobResultEntry
exists for the givenJobID
; otherwisefalse
.
-
hasDirtyJobResultEntryAsync
CompletableFuture<Boolean> hasDirtyJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains adirty
entry for the givenJobID
.- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
, if adirty
entry exists for the givenJobID
; otherwisefalse
.
-
hasCleanJobResultEntryAsync
CompletableFuture<Boolean> hasCleanJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains aclean
entry for the givenJobID
.- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
, if aclean
entry exists for the givenJobID
; otherwise a successfully completed future withfalse
.
-
getDirtyResults
Set<JobResult> getDirtyResults() throws IOException
Get the persistedJobResult
instances that are marked asdirty
. This is useful for recovery of finalization steps.- Returns:
- A set of dirty
JobResults
from the store. - Throws:
IOException
- if collecting the set of dirty results failed for IO reasons.
-
-