Class ThrottleContext

    • 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