Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4316

Improve component wiring performance (avoid NoSuchFieldException)

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major Major
    • 8.6.3
    • 8.6.1
    • General
    • Security Level: Jimmy
    • ZK 8.6.3 S1

      Steps to Reproduce

      extend GenericForwardComposer

      public class MyGenericForwardComposer extends GenericForwardComposer { 
      }
      

      apply the composer to any zk component

       <div apply="MyGenericForwardComposer"/>
      

      Start in debug mode, and set an ExceptionBreakpoint for java.lang.NoSuchFieldException

      Current Result

      The exception break point is triggered 64 times even for this very simple scenario (the same fields are queried multiple times)
      This happens everytime the page is refreshed. For every user.

      The effect multiplies with deeper class hierarchies, and multiple composers in a single page.

      Expected Result

      Caching results to avoid recurring exceptions.

      Debug Info

      Root Cause

      Classes#getAnyField
      https://github.com/zkoss/zk/blob/master/zcommon/src/org/zkoss/lang/Classes.java#L1214-L1225
      same with Classes#getAnyMethod
      https://github.com/zkoss/zk/blob/master/zcommon/src/org/zkoss/lang/Classes.java#L1176-L1194

      Workaround

      SelectorComposer which uses Annotations scanning instead of naming conventions doesn't have this problem.

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: