Spring Integration
  1. Spring Integration
  2. INT-2858

AbstractRequestHandlerAdvice should use 'invocableClone().proceed()'

    Details

    • Type: Defect Defect
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Complete
    • Affects Version/s: 2.2. GA
    • Fix Version/s: 3.0 M1, 2.2.1
    • Component/s: Core
    • Labels:

      Description

      AbstractRequestHandlerAdvice should use 'invocableClone().proceed()' to keep a reference to the other interceptors in the chain on the cyclic nested Advice invocation, e.g. RequestHandlerRetryAdvice.
      The test case to reproduce:

      final AtomicInteger counter = new AtomicInteger(2);
      AbstractReplyProducingMessageHandler handler = new AbstractReplyProducingMessageHandler() {
      	protected Object handleRequestMessage(Message<?> requestMessage) {
      	             return "foo";
      	}
      };
      List<Advice> adviceChain = new ArrayList<Advice>();
      adviceChain.add(new RequestHandlerRetryAdvice());
      adviceChain.add(new MethodInterceptor() {
      public Object invoke(MethodInvocation invocation) throws Throwable {
                     Object result = invocation.proceed();
      		if (counter.getAndDecrement() > 0) {
      	           	throw new RuntimeException("intentional");
      		}
      		return result;
      	}
      });
      handler.setAdviceChain(adviceChain);
      handler.afterPropertiesSet();
      handler.handleMessage(new GenericMessage<String>("Hello, world!"));
      assertTrue(counter.get() == -1);
      

      Similar sulution here: org.springframework.retry.interceptor.RetryOperationsInterceptor

        Activity

        Show
        Artem Bilan added a comment - Isseud PR: https://github.com/SpringSource/spring-integration/pull/693

          People

          • Assignee:
            Artem Bilan
            Reporter:
            Artem Bilan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.5d
              0.5d
              Remaining:
              Remaining Estimate - 0d
              0d
              Logged:
              Time Spent - 0.5d
              0.5d