Package hudson.model
Class RunMap<R extends Run<?,R>>
java.lang.Object
java.util.AbstractMap<Integer,R>
jenkins.model.lazy.AbstractLazyLoadRunMap<R>
hudson.model.RunMap<R>
public final class RunMap<R extends Run<?,R>>
extends AbstractLazyLoadRunMap<R>
implements Iterable<R>
Map
from build number to Run
.
This class is multi-thread safe by using copy-on-write technique,
and it also updates the bi-directional links within Run
accordingly.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
RunMap.Constructor<R extends Run<?,
R>> Run
factory.Nested classes/interfaces inherited from class jenkins.model.lazy.AbstractLazyLoadRunMap
AbstractLazyLoadRunMap.Direction
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<Comparable>
Deprecated.Normally overwritten byLazyBuildMixIn.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
orLazyBuildMixIn.onCreatedFromScratch()
, in turn created duringJob.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
.Fields inherited from class jenkins.model.lazy.AbstractLazyLoadRunMap
dir
-
Constructor Summary
ConstructorDescriptionRunMap()
Deprecated.as of 1.485 UseRunMap(Job, Constructor)
.RunMap
(Job<?, ?> job, RunMap.Constructor cons) RunMap
(File baseDir, RunMap.Constructor cons) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
allowLoad
(int buildNumber) protected BuildReference<R>
createReference
(R r) Reuses the same reference as much as we can.protected String
Subtype to provideRun.getId()
so that this class doesn't have to depend on it.protected int
getNumberOf
(R r) Subtype to provideRun.getNumber()
so that this class doesn't have to depend on it.getView()
Gets the read-only view of this map.iterator()
Walks through builds, newer ones first.void
load
(Job job, RunMap.Constructor<R> cons) Deprecated.as of 1.485 UseRunMap(File, Constructor)
This is the newest build (with the biggest build number)This is the oldest build (with the smallest build number)Add a new build to the map.boolean
boolean
removeValue
(R run) protected R
ParsesR
instance from data in the specified directory.Methods inherited from class jenkins.model.lazy.AbstractLazyLoadRunMap
_put, baseDirInitialized, comparator, entrySet, equals, firstKey, get, get, getByNumber, getLoadedBuilds, hashCode, headMap, initBaseDir, isEmpty, keySet, lastKey, maxNumberOnDisk, newestBuild, oldestBuild, proposeNewNumber, purgeCache, put, putAll, recognizeNumber, reset, runExists, search, subMap, tailMap, updateBaseDir, values
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, remove, size, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, getOrDefault, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size
-
Field Details
-
runIdMigrator
Normally overwritten byLazyBuildMixIn.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
orLazyBuildMixIn.onCreatedFromScratch()
, in turn created duringJob.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
. -
COMPARATOR
Deprecated.as of 1.485 UseComparator.reverseOrder()
-
-
Constructor Details
-
RunMap
Deprecated.as of 1.485 UseRunMap(Job, Constructor)
. -
RunMap
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public RunMap(@NonNull Job<?, ?> job) -
RunMap
- Parameters:
cons
- Used to create new instance ofRun
.- Since:
- 2.451
-
RunMap
Deprecated.
-
-
Method Details
-
remove
-
iterator
Walks through builds, newer ones first. -
removeValue
- Overrides:
removeValue
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
getView
Gets the read-only view of this map. -
newestValue
This is the newest build (with the biggest build number) -
oldestValue
This is the oldest build (with the smallest build number) -
getNumberOf
Description copied from class:AbstractLazyLoadRunMap
Subtype to provideRun.getNumber()
so that this class doesn't have to depend on it.- Specified by:
getNumberOf
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
getIdOf
Description copied from class:AbstractLazyLoadRunMap
Subtype to provideRun.getId()
so that this class doesn't have to depend on it.- Overrides:
getIdOf
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
put
Add a new build to the map. Do not use when loading existing builds (useAbstractLazyLoadRunMap.put(Integer, Object)
).- Overrides:
put
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
getById
- Overrides:
getById
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
createReference
Reuses the same reference as much as we can.If concurrency ends up creating a few extra, that's OK, because we are really just trying to reduce the # of references we create.
- Overrides:
createReference
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
allowLoad
protected boolean allowLoad(int buildNumber) - Overrides:
allowLoad
in classAbstractLazyLoadRunMap<R extends Run<?,
R>>
-
retrieve
Description copied from class:AbstractLazyLoadRunMap
ParsesR
instance from data in the specified directory.- Specified by:
retrieve
in classAbstractLazyLoadRunMap<R extends Run<?,
R>> - Returns:
- null if the parsing failed.
- Throws:
IOException
- if the parsing failed. This is just like returning null except the caller will catch the exception and report it.
-
load
Deprecated.as of 1.485 UseRunMap(File, Constructor)
Backward compatibility method that notifiesRunMap
of who the owner is. Traditionally, this method blocked and loaded all the build records on the disk, but now all the actual loading happens lazily.- Parameters:
job
- Job that owns this map.cons
- Used to create new instance ofRun
.
-
Comparator.reverseOrder()