org.apache.synapse.commons.throttle.core

## Class Throttle

- java.lang.Object
- - org.apache.synapse.commons.throttle.core.Throttle

-     public class Throttle
      extends Object

  The representation for Throttle - holds the both of runtime and static data. There is a one to one relationship between each throttle configuration and context. Currently support two type of throttle configuration. One is remote caller IP based and other one is remote caller domain name based.There may be a concurrent access controller, if the throttle policy has defined the maximum concurrent access .

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Throttle()` Default Constructor - initiates the context and configuration maps

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addThrottleConfiguration(String key, ThrottleConfiguration throttleConfiguration)` Adds a ThrottleConfiguration with the given key - configuration holds all static data for registered callers
    `void` | `addThrottleContext(String key, ThrottleContext throttleContext)` Adds a ThrotleContext with the given key - context holds all runtime data for registered callers
    `ConcurrentAccessController` | `getConcurrentAccessController()` Returns the ConcurrentAccessController - this will control all the concurrent access
    `String` | `getId()` Returns the unique identifier for this throttle
    `ThrottleConfiguration` | `getThrottleConfiguration(String key)` Returns the ThrottleConfiguration for a given key - configuration holds all static data for registered callers
    `ThrottleContext` | `getThrottleContext(String contextID)` Returns the ThrotleContext for a given key - context holds all runtime data for registered callers
    `void` | `setConcurrentAccessController(ConcurrentAccessController controller)` Sets the ConcurrentAccessController - this will control all the concurrent access
    `void` | `setId(String id)` Sets the unique identifier for this throttle

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Throttle

          public Throttle()

      Default Constructor - initiates the context and configuration maps

  - ### Method Detail

    - #### addThrottleConfiguration

          public void addThrottleConfiguration(String key,
                                      ThrottleConfiguration throttleConfiguration)

      Adds a ThrottleConfiguration with the given key - configuration holds all static data for registered callers
      Parameters:
        `key` - - corresponding key for throttle type.This key has one-one relationship with key of contexts
        `throttleConfiguration` - - holds all static data for a throttle - ex: all callers configurations

    - #### addThrottleContext

          public void addThrottleContext(String key,
                                ThrottleContext throttleContext)

      Adds a ThrotleContext with the given key - context holds all runtime data for registered callers
      Parameters:
        `key` - - corresponding key for throttle type.This key has one-one relationship with key of configurations
        `throttleContext` - - holds runtime data - ex: all callers states

    - #### getThrottleContext

          public ThrottleContext getThrottleContext(String contextID)

      Returns the ThrotleContext for a given key - context holds all runtime data for registered callers
      Parameters:
        `contextID` - - corresponding key for throttle type
      Returns:
        ThrottleContext returns the context that holds runtime data - ex: all callers state

    - #### getThrottleConfiguration

          public ThrottleConfiguration getThrottleConfiguration(String key)

      Returns the ThrottleConfiguration for a given key - configuration holds all static data for registered callers
      Parameters:
        `key` - -corresponding key for throttle type
      Returns:
        ThrottleConfiguration Returns configuration that holds all static data for a throttle - ex: all callers configurations

    - #### setConcurrentAccessController

          public void setConcurrentAccessController(ConcurrentAccessController controller)

      Sets the ConcurrentAccessController - this will control all the concurrent access
      Parameters:
        `controller` - - the ConcurrentAccessController instance

    - #### getConcurrentAccessController

          public ConcurrentAccessController getConcurrentAccessController()

      Returns the ConcurrentAccessController - this will control all the concurrent access
      Returns:
        the ConcurrentAccessController instance

    - #### getId

          public String getId()

      Returns the unique identifier for this throttle
      Returns:
        String representation of the id

    - #### setId

          public void setId(String id)

      Sets the unique identifier for this throttle
      Parameters:
        `id` - String representation of the id

Copyright © 2005–2017 Apache Software Foundation. All rights reserved.