Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-712

Regression in Extension proxy method invocations

XMLWordPrintable

      Glassfish issue 13131 [1], involving the Jersey portable extension, notes that there has been a regression in the last integration of Weld (1.1.0-01-glassfish).

      It appears that invocations on observer methods of container lifecycle events are handled in the proxy and delegated to the proxied instance of the Extension, whereas invocations of non-observer methods on a Extension that is obtained from BeanManager, are directed towards the non-proxied instance of the Extension. This behaviour appears to have been changed after Weld 1.0

      More details:
      The Jersey extension has a private initialization method (initialize() [2]) that inits the state of the extension during beforeBeanDiscovery. I notice that there are two instances of the Extension being created (because the extension is being proxied) – let us call it actual_instance1 and proxy_instance_2.

      beforeBeanDiscovery observer method is called on proxy_instance_2 and this method call in turn delegates to actual_instance1 and initialize() method is called on actual_instance1. So now actual_instance1's state is initialized correctly.

      However later when the Extension is looked up through the BeanManager elsewhere [3], the proxy_instance_2 is returned. When a non-observer method (lateInitialize [4]) is called on this instance proxy_instance_2, this method call goes to proxy_instance_2 and is not forwarded to actual_instance_1. Since the state is not initialized in proxy_instance_2, this call fails.

      Please see the attached text file for stack traces related to the various stages discussed above and also contact me should you need to reproduce this.

      [1] http://glassfish.dev.java.net/issues/show_bug.cgi?id=13131
      [2] intialize method in https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/main/java/com/sun/jersey/server/impl/cdi/CDIExtension.java
      [3] constructor in CDIComponentProviderFactory looks up the Extension using the BeanManager https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/main/java/com/sun/jersey/server/impl/cdi/CDIComponentProviderFactory.java
      [4] lateInitialize in https://jersey.dev.java.net/svn/jersey/trunk/jersey/jersey-server/src/main/java/com/sun/jersey/server/impl/cdi/CDIExtension.java

        1. 13131-analysis.txt
          7 kB
          Sivakumar Thyagarajan
        2. relevant-jersey-sources.tar.bz2
          8 kB
          Sivakumar Thyagarajan

              pmuiratbleepbleep Pete Muir (Inactive)
              sivakumart_jira Sivakumar Thyagarajan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: