<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 05/11/2015 03:47 PM, Emily Jiang wrote:<br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div><br clear="all">
                      </div>
                      I have a few questions on interceptors:<br>
                      <br>
                    </div>
                    1. CDI Interceptors on cdi beans<br>
                  </div>
                  Will the interceptors share the same creational
                  context as the bean it is associated with?</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Yes. It is not the very same creational context but a new one with a
    parent-child relationship to the one of the associated bean. This is
    the same as for @Dependent dependencies<br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div> Will Weld managed the cdi interceptors as well as
                  the old-styled interceptors?<br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Yes, Weld manages interceptor bindings associated using interceptor
    bindings as well as those associated using @Interceptors<br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>@Interceptors don't work on other cdi beans except
                  ejb and managed beans, right?<br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    "Managed bean" is ambiguous. Weld support interceptors on all CDI
    managed beans (not on producer fields/methods nor extension-provided
    beans).<br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div><br>
                </div>
                2. Interceptors on ejb beans or managed beans<br>
              </div>
              I think the integrator needs to create these @Interceptors
              and cdi interceptors.</div>
          </div>
        </div>
      </div>
    </blockquote>
    Yes, for EJBs and EE managed beans it is integrator's job to handle
    those. Weld can handle @AroundConstruct interceptors if needed. I've
    updated the docs on this topic recently:
<a class="moz-txt-link-freetext" href="https://github.com/jharting/core/blob/a1eb6194be36ded86dc9709c6767f5016fb98997/docs/reference/src/main/asciidoc/ri-spi.asciidoc#around-construct-interception">https://github.com/jharting/core/blob/a1eb6194be36ded86dc9709c6767f5016fb98997/docs/reference/src/main/asciidoc/ri-spi.asciidoc#around-construct-interception</a><br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div> Will these interceptors use the non-contextual
              creational context (scope @Dependent) or use the ejb or
              managed bean's creational context? <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    ejb or managed bean's creational context
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div><br>
              Will Weld destroy the interceptors when the associated
              beans are destroyed or the integrator need to destroy
              them? This logic applicable to both cdi interceptors and
              @Interceptors style interceptors, right?<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Any time the parent (bean's) creational context is destroyed, the
    children creational contexts (interceptors') are destroyed also by
    Weld.<br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div><br>
            </div>
            3. Interceptors on JavaEE components<br>
          </div>
          I think this interceptors are created by Weld when the JavaEE
          component classes are created, right? By the way, how can the
          container make sure to destroy the interceptors?<br>
        </div>
      </div>
    </blockquote>
    This depends on how the component classes are managed. Assuming the
    components are managed using Weld-provided InjectionTarget then it
    is up to the integrator to decide whether it provides interception
    support or whether it should be provided by Weld. This can be
    configured for each InjectionTarget individually using this builder:
<a class="moz-txt-link-freetext" href="http://docs.jboss.org/weld/javadoc/2.2/weld-spi/org/jboss/weld/manager/api/WeldInjectionTargetBuilder.html">http://docs.jboss.org/weld/javadoc/2.2/weld-spi/org/jboss/weld/manager/api/WeldInjectionTargetBuilder.html</a><br>
    <blockquote
cite="mid:CAECq3A_yrVcz+bGDChAHJi7WRKb+=M7Jvq8ZzkSMv6TFs+OhPw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <br>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>-- <br>
                            <div class="gmail_signature">Thanks<br>
                              Emily<br>
                              =================<br>
                              Emily Jiang<br>
                              <a moz-do-not-send="true"
                                href="mailto:ejiang@apache.org"
                                target="_blank">ejiang@apache.org</a><br>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
weld-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/weld-dev">https://lists.jboss.org/mailman/listinfo/weld-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>