public abstract class CallerContext
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Constructor and Description |
---|
CallerContext(java.lang.String ID) |
Modifier and Type | Method and Description |
---|---|
boolean |
canAccess(ThrottleContext throttleContext,
CallerConfiguration configuration,
long currentTime)
Check whether that caller can access or not ,based on current state and pre-defined policy
|
void |
cleanUpCallers(CallerConfiguration configuration,
ThrottleContext throttleContext,
long currentTime)
Clean up the callers - remove all callers that have expired their time window
|
CallerContext |
clone() |
long |
getFirstAccessTime() |
long |
getGlobalCounter() |
java.lang.String |
getId() |
long |
getLocalCounter() |
long |
getNextTimeWindow()
Returns the next time window
|
java.lang.String |
getRoleId() |
abstract int |
getType()
Gets type of throttle that this caller belong ex : ip/domain
|
long |
getUnitTime() |
java.util.UUID |
getUuid() |
void |
incrementGlobalCounter(int incrementBy) |
void |
incrementLocalCounter() |
void |
resetGlobalCounter() |
void |
resetLocalCounter() |
void |
setFirstAccessTime(long firstAccessTime) |
void |
setGlobalCounter(long counter) |
void |
setLocalCounter(long counter) |
void |
setNextTimeWindow(long nextTimeWindow) |
void |
setRoleId(java.lang.String roleId) |
void |
setUnitTime(long unitTime) |
public CallerContext clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.util.UUID getUuid()
public java.lang.String getId()
public void cleanUpCallers(CallerConfiguration configuration, ThrottleContext throttleContext, long currentTime)
configuration
- -The Configuration for this callerthrottleContext
- -The Throttle that caller having passcurrentTime
- -The system current timepublic boolean canAccess(ThrottleContext throttleContext, CallerConfiguration configuration, long currentTime) throws ThrottleException
throttleContext
- -The Context for this caller - runtime stateconfiguration
- -The Configuration for this caller - data from policycurrentTime
- -The current system timeThrottleException
- throws for invalid throttle configurationpublic long getNextTimeWindow()
public void incrementGlobalCounter(int incrementBy)
public void incrementLocalCounter()
public long getGlobalCounter()
public void setGlobalCounter(long counter)
public void setLocalCounter(long counter)
public long getLocalCounter()
public void resetLocalCounter()
public void resetGlobalCounter()
public abstract int getType()
public long getFirstAccessTime()
public void setFirstAccessTime(long firstAccessTime)
public void setNextTimeWindow(long nextTimeWindow)
public long getUnitTime()
public void setUnitTime(long unitTime)
public java.lang.String getRoleId()
public void setRoleId(java.lang.String roleId)
Copyright © 2005-2020 Apache Software Foundation. All Rights Reserved.