// extract MethodSignature
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
logger.debug("Intercepted a method call on " + methodSignature.toString());
// find the RateLimited annotation, method gets priority over class
RateLimited annotation = methodSignature.getMethod().getAnnotation(RateLimited.class);
if (annotation == null) {
annotation = (RateLimited) joinPoint.getSourceLocation().getWithinType().getAnnotation(RateLimited.class);
}
// resolve method group name based on the methodGrouping in the annotation
String methodGroupName = null;
switch (annotation.methodGrouping()) {
case GROUPED:
methodGroupName = annotation.groupName();
break;
case UNGROUPED:
methodGroupName = methodSignature.toString();
break;
default:
methodGroupName = methodSignature.toString();
break;
}
// get the limiter strategy chain from the spring context
AbstractLimiterStrategy limiterStrategyChain = (AbstractLimiterStrategy) applicationContext.getBean(annotation.limiterBean());
// generate a uuid to be used later on if rollback is required
UUID methodInvocationUUID = UUIDGenerator.generateUUID();
// run through the limiter strategy chain and get the conclusion