Class ConcurrencyThrottleSupport

    • Method Detail

      • setConcurrencyLimit

        public void setConcurrencyLimit​(int concurrencyLimit)
        Set the maximum number of concurrent access attempts allowed. -1 indicates unbounded concurrency.

        In principle, this limit can be changed at runtime, although it is generally designed as a config time setting.

        NOTE: Do not switch between -1 and any concrete limit at runtime, as this will lead to inconsistent concurrency counts: A limit of -1 effectively turns off concurrency counting completely.

      • getConcurrencyLimit

        public int getConcurrencyLimit()
        Return the maximum number of concurrent access attempts allowed.
      • isThrottleActive

        public boolean isThrottleActive()
        Return whether this throttle is currently active.
        Returns:
        true if the concurrency limit for this instance is active
        See Also:
        getConcurrencyLimit()
      • beforeAccess

        protected void beforeAccess()
        To be invoked before the main execution logic of concrete subclasses.

        This implementation applies the concurrency throttle.

        See Also:
        afterAccess()
      • afterAccess

        protected void afterAccess()
        To be invoked after the main execution logic of concrete subclasses.
        See Also:
        beforeAccess()