Class RunLoadCounter


  • public final class RunLoadCounter
    extends Object
    Utility to determine when a build record is loaded.
    Since:
    1.517
    • Method Detail

      • prepare

        @Deprecated
        public static void prepare​(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,​?> project)
                            throws IOException
        Deprecated.
        No longer needed.
        Throws:
        IOException
      • countLoads

        public static int countLoads​(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,​?> project,
                                     Runnable thunk)
        Counts how many build records are loaded as a result of some task.
        Parameters:
        project - a project on which prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>) was called prior to creating builds
        thunk - a task which is expected to load some build records
        Returns:
        how many build records were actually loaded as a result
      • assertMaxLoads

        public static <T> T assertMaxLoads​(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?,​?> project,
                                           int max,
                                           Callable<T> thunk)
                                    throws Exception
        Asserts that at most a certain number of build records are loaded as a result of some task.
        Type Parameters:
        T - the return value type
        Parameters:
        project - a project on which prepare(jenkins.model.lazy.LazyBuildMixIn.LazyLoadingJob<?, ?>) was called prior to creating builds
        max - the maximum number of build records we expect to load
        thunk - a task which is expected to load some build records
        Returns:
        the result of the task, if any
        Throws:
        Exception - if the task failed
        AssertionError - if one more than max build record is loaded