Class ConcurrentRule

  • All Implemented Interfaces:
    CheckingNode, Rule

    public abstract class ConcurrentRule
    extends Object
    implements Rule
    Extend this abstract class to implement a rule in which components passing a main filter are concurrently using a thread pool. Implementing a rule extending this requires that every common variable is handled in a thread-safe way, otherwise the rule might exhibit undeterministic behaviour.
    Since:
    9.10.6
    • Constructor Detail

      • ConcurrentRule

        public ConcurrentRule()
    • Method Detail

      • getDefaultFilterParameter

        public final FilterParameter getDefaultFilterParameter()
        Returns the default filter parameter for this rule.
        Returns:
        the default filter parameter for this rule
        Since:
        9.10.6
      • getDefaultFilter

        public final ComponentFilter getDefaultFilter()
        Returns the default filter for this rule.
        Returns:
        the default filter for this rule
        Since:
        9.10.6
      • preCheck

        public PreCheckResult preCheck()
        This is called once before the checking of components. Use cases: - pre-calculation for checking - pre-condition check A pre-check result must be able to answer two questions: 1) Is proceeding beyond pre-check to check and post-check relevant with the state of the rule and the model? 2) What comment does it have on its result if the result is irrelevant i.e. checking should not proceed beyond pre-check? (e.g. a comment explaining that checking further is irrelevant because rule parameters are malformed or model does not contain any relevant component) If the default filter does not produce any component to check, the result will always be irrelevant because of absence of components, even if a relevant result would otherwise be produced.
        Returns:
        a pre-check result
        Since:
        9.10.6
      • check

        public final void check​(CheckingSelection components,
                                ResultFactory resultFactory)
        Description copied from interface: Rule
        Called to implement the check phase. All the components selected during the pre check phase must be reported as checked through the CheckingSelection instance received as parameter, during the check phase.
        Specified by:
        check in interface Rule
        Parameters:
        components - the CheckingSelection to mark components as checked
        resultFactory - the result factory used to create results for this rule
      • check

        public abstract Collection<Result> check​(Component component,
                                                 ResultFactory resultFactory)
        Called once for each component to be checked.
        Parameters:
        component - the component to check
        resultFactory - the result factory used to create results for this rule
        Returns:
        a collection of the results for the component currently checked
        Since:
        9.10.6