public class ImmutablePlanCacheServiceImpl extends Object implements ImmutablePlanCacheService
ImmutablePlanCacheService.CacheInvalidator
Constructor and Description |
---|
ImmutablePlanCacheServiceImpl(ImmutablePlanManager immutablePlanManager,
PlanDao planDao,
com.atlassian.config.db.HibernateConfig hibernateConfig,
CustomVariableContext customVariableContext,
BuildResultsSummaryDao buildResultsSummaryDao,
VcsRepositoryManager vcsRepositoryManager) |
Modifier and Type | Method and Description |
---|---|
void |
cascadeInvalidate(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(List<T> stages)
Returns a list with deleted stages removed.
|
<T extends ImmutableJob> |
filterOutDeletedIfNeeded(Set<T> jobs)
Returns a set with deleted jobs removed.
|
Optional<ImmutableChain> |
getAnyPlan(Predicate<? super ImmutableChain> predicate)
Returns a plan matching the supplied predicate
|
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.
|
ImmutableChain |
getImmutableChainByKeyIfInCache(PlanKey planKey) |
ImmutableChain |
getImmutablePlanByKey(PlanKey planKey)
Returns a plan if one exists with the key.
|
PlanCacheIndices |
getIndices()
Returns the indices created for plan cache content.
|
<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(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(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)
Resets the latest build summary of a plan.
|
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(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 ImmutablePlanManager immutablePlanManager, @NotNull PlanDao planDao, @NotNull com.atlassian.config.db.HibernateConfig hibernateConfig, @NotNull CustomVariableContext customVariableContext, @NotNull BuildResultsSummaryDao buildResultsSummaryDao, @NotNull VcsRepositoryManager vcsRepositoryManager)
@Nullable public ImmutableChain getImmutablePlanByKey(@NotNull PlanKey planKey)
ImmutablePlanCacheService
getImmutablePlanByKey
in interface ImmutablePlanCacheService
ImmutablePlanCacheService.withHiddenPlans(Collection, Supplier)
@Nullable public ImmutableChain getImmutableChainByKeyIfInCache(@NotNull PlanKey planKey)
getImmutableChainByKeyIfInCache
in interface ImmutablePlanCacheService
public void invalidate(@NotNull PlanKey planKey)
ImmutablePlanCacheService
invalidate
in interface ImmutablePlanCacheService
planKey
- key of the Plan to be removed from cachepublic void cascadeInvalidate(@NotNull PlanKey planKey)
ImmutablePlanCacheService
cascadeInvalidate
in interface ImmutablePlanCacheService
planKey
- key of the Plan to be removed from cachepublic void getChainsToInvalidateAndReindex(ImmutablePlanCacheService.CacheInvalidator invalidator, Set<PlanKey> chainsToInvalidate, Set<PlanKey> chainsToReindex)
ImmutablePlanCacheService
getChainsToInvalidateAndReindex
in interface ImmutablePlanCacheService
public void remove(@NotNull PlanKey planKey)
ImmutablePlanCacheService
remove
in interface ImmutablePlanCacheService
planKey
- key of the Plan to be removed from cachepublic void onStageDeleted(long stageId)
onStageDeleted
in interface ImmutablePlanCacheService
public void initialiseCache()
ImmutablePlanCacheService
initialiseCache
in interface ImmutablePlanCacheService
public void disableCache()
ImmutablePlanCacheService
disableCache
in interface ImmutablePlanCacheService
public void enableCache()
ImmutablePlanCacheService
ImmutablePlanCacheService.initialiseCache()
instead if you expect plans to be loaded.enableCache
in interface ImmutablePlanCacheService
public BambooCacheStats getCacheStats()
ImmutablePlanCacheService
getCacheStats
in interface ImmutablePlanCacheService
@NotNull public PlanCacheIndices getIndices()
ImmutablePlanCacheService
getIndices
in interface ImmutablePlanCacheService
@NotNull public <T extends ImmutablePlan> Stream<T> getPlans(Class<T> planType, @NotNull com.google.common.base.Predicate<? super T> filter)
ImmutablePlanCacheService
getPlans
in interface ImmutablePlanCacheService
planType
- - the type of the plan to retrieveDescriptionProvider.getName()
public <T> T withHiddenPlans(Collection<PlanKey> planKeys, Supplier<T> supplier)
ImmutablePlanCacheService
withHiddenPlans
in interface ImmutablePlanCacheService
@NotNull public Range<Integer> getBuildNumbersRange(PlanKey planKey)
ImmutablePlanCacheService
getBuildNumbersRange
in interface ImmutablePlanCacheService
public void invalidateBuildNumbersRange(PlanKey planKey, int buildNumber, boolean trueForSaveFalseForDelete)
ImmutablePlanCacheService
invalidateBuildNumbersRange
in interface ImmutablePlanCacheService
public Stream<ImmutablePlan> getPlans(Predicate<ImmutablePlan> predicate)
ImmutablePlanCacheService
getPlans
in interface ImmutablePlanCacheService
public Optional<ImmutableChain> getAnyPlan(Predicate<? super ImmutableChain> predicate)
ImmutablePlanCacheService
getAnyPlan
in interface ImmutablePlanCacheService
public void invalidateLatestResultSummary(PlanResultKey planResultKey)
ImmutablePlanCacheService
invalidateLatestResultSummary
in interface ImmutablePlanCacheService
public void invalidateAllLatestResultSummaries()
ImmutablePlanCacheService
invalidateAllLatestResultSummaries
in interface ImmutablePlanCacheService
public void indexPlan(@NotNull ImmutableChain plan)
ImmutablePlanCacheService
indexPlan
in interface ImmutablePlanCacheService
public void hideDeletedPlan(PlanKey planKey)
ImmutablePlanCacheService
hideDeletedPlan
in interface ImmutablePlanCacheService
public void hideDeletedStage(Long stageId)
ImmutablePlanCacheService
hideDeletedStage
in interface ImmutablePlanCacheService
public boolean isPlanBeingDeleted(PlanKey planKey)
isPlanBeingDeleted
in interface ImmutablePlanCacheService
public void enterDeletionCodeSection()
ImmutablePlanCacheService
enterDeletionCodeSection
in interface ImmutablePlanCacheService
public void leaveDeletionCodeSection()
ImmutablePlanCacheService
leaveDeletionCodeSection
in interface ImmutablePlanCacheService
@NotNull public <T extends ImmutableJob> Set<T> filterOutDeletedIfNeeded(@NotNull Set<T> jobs)
ImmutablePlanCacheService
filterOutDeletedIfNeeded
in interface ImmutablePlanCacheService
@NotNull public <T extends ImmutableChainStage> List<T> filterOutDeletedIfNeeded(@NotNull List<T> stages)
ImmutablePlanCacheService
filterOutDeletedIfNeeded
in interface ImmutablePlanCacheService
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.