org.apache.synapse.commons.throttle.core

## Class ThrottleContext

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

- Direct Known Subclasses:
    DomainBaseThrottleContext, IPBaseThrottleContext, RoleBaseThrottleContext

      public abstract class ThrottleContext
      extends Object

  Holds the all runtime data corresponding to call remote callers. In addition to that this hold clean list for callers.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThrottleContext(ThrottleConfiguration throttleConfiguration, ThrottleReplicator throttleReplicator)` default constructor – expects a throttle configuration.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAndFlushCallerContext(CallerContext callerContext, String id)` To add the caller and replicates the states of the given caller
    `void` | `addCallerContext(CallerContext callerContext, String id)` setting callerContext - put callersMap against time and put time against remote caller id (ip/domain)
    `void` | `cleanupCallers(long time)` This method will clean up callers which has next access time below from provided time This will first check the prohibited period and then it will check next access time lesser than unit time before a cleanup a caller
    `void` | `flushCallerContext(CallerContext callerContext, String id)` To replicates the states of the already exist caller
    `CallerContext` | `getCallerContext(String id)` To get the runtime states of a remote caller
    `org.apache.axis2.context.ConfigurationContext` | `getConfigurationContext()`
    `ThrottleConfiguration` | `getThrottleConfiguration()` To get the ThrottleConfiguration
    `String` | `getThrottleId()`
    `abstract int` | `getType()`
    `void` | `processCleanList(long time)` /** processing cleaning list- only process callerContexts which unit time already had over
    `void` | `removeAndDestroyShareParamsOfCaller(String id)` Removes the caller and destroy shared params of caller
    `void` | `removeAndFlushCaller(String id)` Removes the caller and replicate the states
    `void` | `removeCallerContext(String id)` removing a caller with a given id - caller will remove from clean list
    `void` | `replicateTimeWindow(String id)` Replicate the time window of this caller
    `void` | `setConfigurationContext(org.apache.axis2.context.ConfigurationContext configurationContext)`
    `void` | `setThrottleId(String throttleId)`

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

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

- - ### Constructor Detail

    - #### ThrottleContext

          public ThrottleContext(ThrottleConfiguration throttleConfiguration,
                                 ThrottleReplicator throttleReplicator)

      default constructor – expects a throttle configuration.
      Parameters:
        `throttleConfiguration` - - configuration data according to the policy

  - ### Method Detail

    - #### getThrottleConfiguration

          public ThrottleConfiguration getThrottleConfiguration()

      To get the ThrottleConfiguration
      Returns:
        ThrottleConfiguration returns the ThrottleConfiguration of this context

    - #### getCallerContext

          public CallerContext getCallerContext(String id)

      To get the runtime states of a remote caller
      Parameters:
        `id` - the remote caller id ex: domain , ip
      Returns:
        Returns the CallerContext which holds runtime state of a remote caller

    - #### addCallerContext

          public void addCallerContext(CallerContext callerContext,
                                       String id)

      setting callerContext - put callersMap against time and put time against remote caller id (ip/domain)
      Parameters:
        `callerContext` - - The remote caller's runtime data.
        `id` - - The id of the remote caller

    - #### removeCallerContext

          public void removeCallerContext(String id)

      removing a caller with a given id - caller will remove from clean list
      Parameters:
        `id` - Caller ID

    - #### processCleanList

          public void processCleanList(long time)

      /** processing cleaning list- only process callerContexts which unit time already had over
      Parameters:
        `time` - - the current System Time
      Throws:
        `ThrottleException`

    - #### setThrottleId

          public void setThrottleId(String throttleId)

    - #### getThrottleId

          public String getThrottleId()

    - #### getConfigurationContext

          public org.apache.axis2.context.ConfigurationContext getConfigurationContext()

    - #### setConfigurationContext

          public void setConfigurationContext(org.apache.axis2.context.ConfigurationContext configurationContext)

    - #### getType

          public abstract int getType()

      Returns:
        Returns the type of throttle ex : ip /domain

    - #### addAndFlushCallerContext

          public void addAndFlushCallerContext(CallerContext callerContext,
                                               String id)

      To add the caller and replicates the states of the given caller
      Parameters:
        `callerContext` - The states of the caller
        `id` - The id of the caller

    - #### flushCallerContext

          public void flushCallerContext(CallerContext callerContext,
                                         String id)

      To replicates the states of the already exist caller
      Parameters:
        `callerContext` - The states of the caller
        `id` - The id of the remote caller

    - #### removeAndFlushCaller

          public void removeAndFlushCaller(String id)

      Removes the caller and replicate the states
      Parameters:
        `id` - The Id of the caller

    - #### removeAndDestroyShareParamsOfCaller

          public void removeAndDestroyShareParamsOfCaller(String id)

      Removes the caller and destroy shared params of caller
      Parameters:
        `id` - The Id of the caller

    - #### replicateTimeWindow

          public void replicateTimeWindow(String id)

      Replicate the time window of this caller
      Parameters:
        `id` -

    - #### cleanupCallers

          public void cleanupCallers(long time)

      This method will clean up callers which has next access time below from provided time This will first check the prohibited period and then it will check next access time lesser than unit time before a cleanup a caller
      Parameters:
        `time` - to clean up the caller contexts

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