public class ImmutablePlanCacheServiceImpl extends Object implements ImmutablePlanCacheService
ImmutablePlanCacheService.CacheInvalidator| Constructor and Description |
|---|
ImmutablePlanCacheServiceImpl(@NotNull ImmutablePlanManager immutablePlanManager,
@NotNull PlanDao planDao,
@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig,
@NotNull CustomVariableContext customVariableContext,
@NotNull BuildResultsSummaryDao buildResultsSummaryDao,
@NotNull VcsRepositoryManager vcsRepositoryManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
cascadeInvalidate(@NotNull PlanKey planKey)
Removes the cached reference for the passed plan and its children.
|
void |
disableCache()
Disable cache.
|
void |
enableCache()
Enable cache.
|
void |
enterDeletionCodeSection()
Marks the current thread as being able to see deleted plans.
|
<T extends ImmutableChainStage> |
filterOutDeletedIfNeeded(@NotNull List<T> stages)
Returns a list with deleted stages removed.
|
<T extends ImmutableJob> |
filterOutDeletedIfNeeded(@NotNull Set<T> jobs)
Returns a set with deleted jobs removed.
|
Optional<ImmutableChain> |
getAnyPlan(Predicate<? super ImmutableChain> predicate)
Returns a plan matching the supplied predicate
|
@NotNull Range<Integer> |
getBuildNumbersRange(PlanKey planKey)
internal use only.
|
BambooCacheStats |
getCacheStats()
Retrieve cache statistics
|
void |
getChainsToInvalidateAndReindex(ImmutablePlanCacheService.CacheInvalidator invalidator,
Set<PlanKey> chainsToInvalidate,
Set<PlanKey> chainsToReindex)
Internal.
|
@Nullable ImmutableChain |
getImmutableChainByKeyIfInCache(@NotNull PlanKey planKey) |
@Nullable ImmutableChain |
getImmutablePlanByKey(@NotNull PlanKey planKey)
Returns a plan if one exists with the key.
|
@NotNull PlanCacheIndices |
getIndices()
Returns the indices created for plan cache content.
|
<T extends ImmutablePlan> |
getPlanKeysByProject(long projectId,
@NotNull Class<T> planType)
Returns all keys of all plans that belong to a project and have specified type.
|
<T extends ImmutablePlan> |
getPlans(Class<T> planType,
com.google.common.base.Predicate<? super T> filter)
|
Stream<ImmutablePlan> |
getPlans(Predicate<ImmutablePlan> predicate)
Returns a stream of plans (chains+jobs) matching the supplied predicate.
|
void |
hideDeletedPlan(PlanKey planKey)
Hides the plan.
|
void |
hideDeletedStage(Long stageId)
Hides the stage.
|
void |
indexPlan(@NotNull ImmutableChain plan)
Updates plan indexes in cache
|
void |
initialiseCache()
Clear the cache and attempt to read all Chains from DB in order to cache them.
|
void |
invalidate(@NotNull PlanKey planKey)
Removes the cached Plan.
|
void |
invalidateAllLatestResultSummaries()
Invalidates all latest result summaries currently cached.
|
void |
invalidateBuildNumbersRange(PlanKey planKey,
int buildNumber,
boolean trueForSaveFalseForDelete)
internal use only.
|
void |
invalidateLatestResultSummary(PlanResultKey planResultKey,
boolean resetAverageBuildDuration)
Resets the latest build summary of a plan.
|
void |
invalidateSpecsStateForPlan(@NotNull PlanKey planKey,
@Nullable ImmutableVcsBambooSpecsSource immutableVcsBambooSpecsSource)
Invalidate specs state.
|
boolean |
isCacheEnabled() |
boolean |
isPlanBeingDeleted(PlanKey planKey) |
void |
leaveDeletionCodeSection()
Marks the current thread as no longer being able to see deleted plans.
|
void |
onStageDeleted(long stageId) |
void |
remove(@NotNull PlanKey planKey)
Removes the cached Plan and its metadata.
|
<T> T |
withHiddenPlans(Collection<PlanKey> planKeys,
Supplier<T> supplier)
Invokes supplier while marking the specified plan keys as unavailable.
|
public ImmutablePlanCacheServiceImpl(@NotNull
@NotNull ImmutablePlanManager immutablePlanManager,
@NotNull
@NotNull PlanDao planDao,
@NotNull
@NotNull com.atlassian.config.db.HibernateConfig hibernateConfig,
@NotNull
@NotNull CustomVariableContext customVariableContext,
@NotNull
@NotNull BuildResultsSummaryDao buildResultsSummaryDao,
@NotNull
@NotNull VcsRepositoryManager vcsRepositoryManager)
@Nullable public @Nullable ImmutableChain getImmutablePlanByKey(@NotNull @NotNull PlanKey planKey)
ImmutablePlanCacheServicegetImmutablePlanByKey in interface ImmutablePlanCacheServiceImmutablePlanCacheService.withHiddenPlans(Collection, Supplier)@Nullable public @Nullable ImmutableChain getImmutableChainByKeyIfInCache(@NotNull @NotNull PlanKey planKey)
getImmutableChainByKeyIfInCache in interface ImmutablePlanCacheServicepublic void invalidate(@NotNull
@NotNull PlanKey planKey)
ImmutablePlanCacheServiceinvalidate in interface ImmutablePlanCacheServiceplanKey - key of the Plan to be removed from cachepublic void cascadeInvalidate(@NotNull
@NotNull PlanKey planKey)
ImmutablePlanCacheServicecascadeInvalidate in interface ImmutablePlanCacheServiceplanKey - key of the Plan to be removed from cachepublic void getChainsToInvalidateAndReindex(ImmutablePlanCacheService.CacheInvalidator invalidator, Set<PlanKey> chainsToInvalidate, Set<PlanKey> chainsToReindex)
ImmutablePlanCacheServicegetChainsToInvalidateAndReindex in interface ImmutablePlanCacheServicepublic void remove(@NotNull
@NotNull PlanKey planKey)
ImmutablePlanCacheServiceremove in interface ImmutablePlanCacheServiceplanKey - key of the Plan to be removed from cachepublic void onStageDeleted(long stageId)
onStageDeleted in interface ImmutablePlanCacheServicepublic void initialiseCache()
ImmutablePlanCacheServiceinitialiseCache in interface ImmutablePlanCacheServicepublic void disableCache()
ImmutablePlanCacheServicedisableCache in interface ImmutablePlanCacheServicepublic void enableCache()
ImmutablePlanCacheServiceImmutablePlanCacheService.initialiseCache() instead if you expect plans to be loaded.enableCache in interface ImmutablePlanCacheServicepublic boolean isCacheEnabled()
isCacheEnabled in interface ImmutablePlanCacheServicepublic BambooCacheStats getCacheStats()
ImmutablePlanCacheServicegetCacheStats in interface ImmutablePlanCacheService@NotNull public @NotNull PlanCacheIndices getIndices()
ImmutablePlanCacheServicegetIndices in interface ImmutablePlanCacheService@NotNull public <T extends ImmutablePlan> @NotNull Stream<T> getPlans(Class<T> planType, @NotNull com.google.common.base.Predicate<? super T> filter)
ImmutablePlanCacheServicegetPlans in interface ImmutablePlanCacheServiceplanType - - the type of the plan to retrieveDescriptionProvider.getName()@NotNull public <T extends ImmutablePlan> @NotNull Stream<PlanKey> getPlanKeysByProject(long projectId, @NotNull @NotNull Class<T> planType)
ImmutablePlanCacheServicegetPlanKeysByProject in interface ImmutablePlanCacheServicepublic <T> T withHiddenPlans(Collection<PlanKey> planKeys, Supplier<T> supplier)
ImmutablePlanCacheServicewithHiddenPlans in interface ImmutablePlanCacheService@NotNull public @NotNull Range<Integer> getBuildNumbersRange(PlanKey planKey)
ImmutablePlanCacheServicegetBuildNumbersRange in interface ImmutablePlanCacheServicepublic void invalidateBuildNumbersRange(PlanKey planKey, int buildNumber, boolean trueForSaveFalseForDelete)
ImmutablePlanCacheServiceinvalidateBuildNumbersRange in interface ImmutablePlanCacheServicepublic Stream<ImmutablePlan> getPlans(Predicate<ImmutablePlan> predicate)
ImmutablePlanCacheServicegetPlans in interface ImmutablePlanCacheServicepublic Optional<ImmutableChain> getAnyPlan(Predicate<? super ImmutableChain> predicate)
ImmutablePlanCacheServicegetAnyPlan in interface ImmutablePlanCacheServicepublic void invalidateLatestResultSummary(PlanResultKey planResultKey, boolean resetAverageBuildDuration)
ImmutablePlanCacheServiceinvalidateLatestResultSummary in interface ImmutablePlanCacheServicepublic void invalidateAllLatestResultSummaries()
ImmutablePlanCacheServiceinvalidateAllLatestResultSummaries in interface ImmutablePlanCacheServicepublic void invalidateSpecsStateForPlan(@NotNull
@NotNull PlanKey planKey,
@Nullable
@Nullable ImmutableVcsBambooSpecsSource immutableVcsBambooSpecsSource)
ImmutablePlanCacheServiceinvalidateSpecsStateForPlan in interface ImmutablePlanCacheServiceplanKey - plan keyimmutableVcsBambooSpecsSource - new statepublic void indexPlan(@NotNull
@NotNull ImmutableChain plan)
ImmutablePlanCacheServiceindexPlan in interface ImmutablePlanCacheServicepublic void hideDeletedPlan(PlanKey planKey)
ImmutablePlanCacheServicehideDeletedPlan in interface ImmutablePlanCacheServicepublic void hideDeletedStage(Long stageId)
ImmutablePlanCacheServicehideDeletedStage in interface ImmutablePlanCacheServicepublic boolean isPlanBeingDeleted(PlanKey planKey)
isPlanBeingDeleted in interface ImmutablePlanCacheServicepublic void enterDeletionCodeSection()
ImmutablePlanCacheServiceenterDeletionCodeSection in interface ImmutablePlanCacheServicepublic void leaveDeletionCodeSection()
ImmutablePlanCacheServiceleaveDeletionCodeSection in interface ImmutablePlanCacheService@NotNull public <T extends ImmutableJob> @NotNull Set<T> filterOutDeletedIfNeeded(@NotNull @NotNull Set<T> jobs)
ImmutablePlanCacheServicefilterOutDeletedIfNeeded in interface ImmutablePlanCacheService@NotNull public <T extends ImmutableChainStage> @NotNull List<T> filterOutDeletedIfNeeded(@NotNull @NotNull List<T> stages)
ImmutablePlanCacheServicefilterOutDeletedIfNeeded in interface ImmutablePlanCacheServiceCopyright © 2023 Atlassian Software Systems Pty Ltd. All rights reserved.