Class LimitSupport


  • public class LimitSupport
    extends Object
    Utility class to check easily and performantly if Limits were hit or not.
    Since:
    jadice server 4.3.1.0
    • Constructor Detail

      • LimitSupport

        public LimitSupport​(WorkerController<? extends Node> controller)
        Create a controller dependent LimitSupport (i.e. in the context of a NodeWorker ).
        Parameters:
        controller - The controller where to emit warnings or failures if Limits are hit.
      • LimitSupport

        public LimitSupport​(ServerJob job,
                            Job clientJob)
        Create a job dependent LimitSupport (i.e. not in the context of a NodeWorker).
        Parameters:
        job - The ServerJob where to emit warnings or failures if Limits are hit.
        clientJob - The client side part of the job that contains the Limits.
    • Method Detail

      • getNextSignificantLimit

        public <L extends Limit> L getNextSignificantLimit​(Class<L> limitType,
                                                           Limit.WhenExceedAction action)
        Get the next Limit of given Type and Action that is not exceeded yet and that will be triggered on test(Class, long).
        Type Parameters:
        L - Limit type
        Parameters:
        limitType - Class of the Limit type to look for
        action - The action to look for
        Returns:
        The next significant Limit
      • test

        public void test​(Class<? extends Limit> limitType,
                         long count)
        Test if the Limits of the given type were hit.
        Parameters:
        limitType - The Limit type to check
        count - the value to check