Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2800

Re-invoking InterceptorContext.proceed() throws CannotProceedException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.0.0.Final
    • None
    • None
    • None
    • Hide

      Deploy a session bean that requires a transaction and have it throw a org.jboss.util.deadlock.ApplicationDeadlockException.

      or

      Add the following test case to org.jboss.invocation.test.ChainedInterceptorTestCase and run mvn test on the jboss-invocation subproject.

          /**
           * What if again re-invokes a chained interceptor?
           */
          @Test
          public void testAgainWithChain() throws Exception {
              Method method = ChainedInterceptorTestCase.class.getMethod("echo", String.class);
              InterceptorContext context = new InterceptorContext();
              context.setMethod(method);
              context.setTarget(this);
              context.setParameters(new Object[] { "testAgain" });
      
              Interceptor again = new Interceptor() {
                  private int num = 2;
                  @Override
                  public Object processInvocation(InterceptorContext context) throws Exception {
                      StringBuilder result = new StringBuilder();
                      while ((num--) > 0)
                          result.append(context.proceed());
                      return result;
                  }       
              };      
              Interceptor interceptor1 = Interceptors.getChainedInterceptor(createMyInterceptor("1"), createMyInterceptor("2"), Interceptors.getInvokingInterceptor());
              Interceptor interceptor2 = Interceptors.getChainedInterceptor(createMyInterceptor("3"), createMyInterceptor("4"), again, interceptor1);
      
              String result = (String) interceptor2.processInvocation(context);
              String expected = "3#4#1#2#Echo testAgain1#2#Echo testAgain";
              assertEquals(expected, result);
          }       
      }
      
      Show
      Deploy a session bean that requires a transaction and have it throw a org.jboss.util.deadlock.ApplicationDeadlockException. or Add the following test case to org.jboss.invocation.test.ChainedInterceptorTestCase and run mvn test on the jboss-invocation subproject. /** * What if again re-invokes a chained interceptor? */ @Test public void testAgainWithChain() throws Exception { Method method = ChainedInterceptorTestCase. class. getMethod( "echo" , String .class); InterceptorContext context = new InterceptorContext(); context.setMethod(method); context.setTarget( this ); context.setParameters( new Object [] { "testAgain" }); Interceptor again = new Interceptor() { private int num = 2; @Override public Object processInvocation(InterceptorContext context) throws Exception { StringBuilder result = new StringBuilder(); while ((num--) > 0) result.append(context.proceed()); return result; } }; Interceptor interceptor1 = Interceptors.getChainedInterceptor(createMyInterceptor( "1" ), createMyInterceptor( "2" ), Interceptors.getInvokingInterceptor()); Interceptor interceptor2 = Interceptors.getChainedInterceptor(createMyInterceptor( "3" ), createMyInterceptor( "4" ), again, interceptor1); String result = ( String ) interceptor2.processInvocation(context); String expected = "3#4#1#2#Echo testAgain1#2#Echo testAgain" ; assertEquals(expected, result); } }

    Description

      When you invoke and re-invoke org.jboss.invocation.InterceptorContext.proceed() from an interceptor in a chain of interceptors and the interceptor to be (re-)invoked is a org.jboss.invocation.ChainedInterceptor or WeavedInterceptor, a CannotProceedException is thrown.

      This bug has been described and analysed in the context of the ejb3 container, on the forum at https://community.jboss.org/message/853547.

      Attachments

        Activity

          People

            dlloyd@redhat.com David Lloyd
            maarel Eric van der Maarel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: