public class BuildCache extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
BuildCache.BuildComparator
Allows returned downstreamBuild Sets to be sorted first by project name and then by number.
|
static class |
BuildCache.QueueTaskComparator |
| Constructor and Description |
|---|
BuildCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
doGarbageCollect() |
static BuildCache |
getCache()
Returns the instance of this class.
|
Set<hudson.model.Run> |
getDownstreamBuilds(hudson.model.Run run)
Returns all downstream builds triggered by the upstream builds.
|
Set<hudson.model.Run> |
getDownstreamBuildsByProject(hudson.model.Run upstreamBuild,
hudson.model.Job downstreamProject)
Fetches all downstream builds belonging to the specified project.
|
static Set<hudson.model.Queue.Item> |
getDownstreamQueueItems(hudson.model.Queue.Item[] items,
hudson.model.Run run)
Helper method to find downstream Queue.Items triggered by Run.
|
static Set<hudson.model.Queue.Item> |
getDownstreamQueueItems(hudson.model.Run run)
Helper method to find downstream Queue.Items triggered by Run.
|
String |
getStatistics()
Builds a summary report of the cache
|
static void |
initCache()
Initialize the cache after all jobs are loaded.
|
void |
reloadCache()
Clears and reloads cache from disk.
|
protected void |
removeFromCache(hudson.model.Run run)
Remove a run from the cache.
|
void |
startGarbageCollector() |
static void |
stop() |
void |
stopGarbageCollector() |
protected void |
updateCache(hudson.model.Run downstreamRun)
Parses upstream causes in a downstream build and updates the cache.
|
public static BuildCache getCache()
@Initializer(after=JOB_LOADED) public static void initCache()
public static Set<hudson.model.Queue.Item> getDownstreamQueueItems(hudson.model.Run run)
run - The upstream buildpublic static Set<hudson.model.Queue.Item> getDownstreamQueueItems(hudson.model.Queue.Item[] items, hudson.model.Run run)
Since Queue.getItems() is validating readability permissions on every queue item, this method allows for providing a cached version of the Queue.Items. This is helpful if many Queue downstream look-ups are needed within a very short span of time.
items - The cached version of Queue.getItems()run - The upstream buildpublic void reloadCache()
E.g. @Initializer(after = JOB_LOADED)
protected void updateCache(hudson.model.Run downstreamRun)
downstreamRun - Downstream build to update the cache withpublic void doGarbageCollect()
public void stopGarbageCollector()
public void startGarbageCollector()
public Set<hudson.model.Run> getDownstreamBuilds(hudson.model.Run run)
run - The upstream buildpublic String getStatistics()
protected void removeFromCache(hudson.model.Run run)
run - The run to remove from the cache.public Set<hudson.model.Run> getDownstreamBuildsByProject(hudson.model.Run upstreamBuild, hudson.model.Job downstreamProject)
upstreamBuild - The upstream builddownstreamProject - The downstream projectCopyright © 2016–2019. All rights reserved.