We have a function annotation as follows:
public class AnInterfaceImpl implements AnInterface { @FairThreadUsageByEntity(entityName = "XYXYXYX", numberOfThreads = 1) public Report getReport(final String One, final String Two) {
Spring Configuration:
<aop:aspectj-autoproxy /> <bean class="com.amazon.utils.fairthreadusage.aspect.FairThreadUsageByEntityAdvice" />
Annotations are implemented as one aspect. The main functionality is to limit the number of threads used by a certain type of functionality, say, download. The following is the FairThreadUsageByEntity annotation FairThreadUsageByEntity :
@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface FairThreadUsageByEntity { public String entityName(); public int numberOfThreads(); } @Aspect public class FairThreadUsageByEntityAdvice extends FairThreadUsageBase { @Around("@annotation(fairUsage)") public Object fairThreadUsageByEntity(final ProceedingJoinPoint pjp, final FairThreadUsageByEntity fairUsage) throws Throwable {
Annotation does not work. I am using AspectJWeaver 1.7 and java 1.7. Let me know if anything else is needed. Any help was appreciated.
EDIT: adding a controller as well as a getReport call function
public class ReportDownloadRootController extends BaseRootController { public static final String REQUEST_MAPPING_REPORT_DOWNLOAD = "/hz/inventory/addproducts/status/report"; public static final String PARAM_REFERENCE_ID = "reference_id"; private AnInterface anInterface; @RequestMapping(REQUEST_MAPPING_REPORT_DOWNLOAD) public void execute(@RequestParam(value = PARAM_REFERENCE_ID, required = true) final String referenceId, final HttpServletRequest request, final HttpServletResponse response) { try { Report report = AnInterface.getReport(referenceId, getContext().getMerchantId());
EDIT 2: Spring bean for AnInterface
<bean id="AnInterface" class="com.facade.feed.AnInterfaceImpl" />
source share