1 2 3 Previous Next 38 Replies Latest reply on Oct 25, 2011 6:54 PM by jakec Go to original post
      • 30. Re: Seam performance problem + rewarding workaround...
        deanhiller2000

        oh,coooool, CallChain was already a ThreadLocal!!! 

        • 31. Re: Seam performance problem + rewarding workaround...
          deanhiller2000

          coooool, so I didn't really like having to add @MeasureTime to each bean and really just wanted all beans to be included automatically(well, all the ones with interceptors), so I finally figured out how to add interceptors to all beans that have interceptors already...




          @Name("ourInit")
          @Scope(ScopeType.APPLICATION)
          @BypassInterceptors
          @Install(value=true)
          @Startup
          public class OurInit {
               
               private static final Logger log = Logger.getLogger(OurInit.class.getName());
               
               @Create
               public void start() {
                    
                    process(Contexts.getApplicationContext());
          
               }
          
               private static void process(Context ctx) {
                    String[] names = ctx.getNames();
                    for(String name : names) {
                         Object obj = ctx.get(name);
                         if(!(obj instanceof Component))
                              continue;
                         
                         Component comp = (Component) obj;
                         log.info("processing="+name+" class="+comp.getBeanClass());
                         List<Interceptor> interceptors = comp.getInterceptors(InterceptorType.SERVER);
                         if(interceptors.size() > 0) {
                              log.info("add interceptor to begin of size="+interceptors.size());
                              interceptors.add(0, new Interceptor(new TimingInterceptor(), comp));
                         } else {
                              log.info("has no interceptors.......skipping");
                         }
                         
                    }
               }
          }
          



          • 32. Re: Seam performance problem + rewarding workaround...
            juergenb

            Wow! Cool! Thank you very much Tobias and everybody for this enlightment.


            I used a datatable which caused me much headache until I used @BypassInterceptors.

            • 33. Re: Seam performance problem + rewarding workaround...
              bgroeneveld

              This is proving really useful.  In trying to implement Dean's idea of watching all bean automatically I'm confronted with the following exception when the times are collected (below).  What am I missing here?  Thanks!




              Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: TimingInterceptor.timeCall(org.jboss.seam.intercept.InvocationContext) with parameters: (org.jboss.seam.intercept.EE5SeamInvocationContext) on: org.jboss.seam.core.MethodContextInterceptor

              • 34. Re: Seam performance problem + rewarding workaround...
                antibrumm.mfrey0.bluewin.ch

                I was using the TimingInterceptor since i found this thread and the only thing that annoyed me was that we have to declare the interceptor everywhere.


                Thanks alot Dean!!!

                • 35. Re: Seam performance problem + rewarding workaround...
                  omontano

                  I tried doing a-level interceptor method but not working. I wonder if it can be done

                  • 36. Re: Seam performance problem + rewarding workaround...
                    gaboo.gael.livre-rare-book.com

                    I'm having this issue too. Does someone has any idea about how to fix it ?
                    Thanks!

                    • 37. Re: Seam performance problem + rewarding workaround...
                      gaboo.gael.livre-rare-book.com

                      Ben Groeneveld wrote on Jan 04, 2011 17:58:


                      This is proving really useful.  In trying to implement Dean's idea of watching all bean automatically I'm confronted with the following exception when the times are collected (below).  What am I missing here?  Thanks!



                      Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: TimingInterceptor.timeCall(org.jboss.seam.intercept.InvocationContext) with parameters: (org.jboss.seam.intercept.EE5SeamInvocationContext) on: org.jboss.seam.core.MethodContextInterceptor


                      This issue, easier to understand the reply with the quote :)

                      • 38. Re: Seam performance problem + rewarding workaround...
                        jakec

                        I know this is an old post, but there has never been a response to the IllegalArgumentException, which I am also getting.


                        I don't really understand what is going on here. It has an instance of MethodContextInterceptor, but the Method it is trying to call is the TimingInterceptor.timeCall method, but TimingInterceptor is NOT an instance of MethodContextInterceptor. How is it that Interceptor.aroundInvoke() is being called by SeamInvocationContext.proceed() with a userInteceptor that is of a different class than the one the aroundInvokeMethod came from?


                        This is in Seam 2.0.1.GA.

                        1 2 3 Previous Next