Re: [weld-dev] Principal built-in bean

2017-09-04 Thread arjan tijms
Hi,

On Mon, Sep 4, 2017 at 11:17 AM, Martin Kouba <mko...@redhat.com> wrote:

> Well, it works similar to how @Dependent stateless session beans work.
> Unlike @RequestScoped there is no real CDI context just a special proxy
> that delegates to SPI.


Indeed, it can't be really request scope, since the principal can
potentially change many times during a request. Though, once initially set
it normally applies for the remainder of the web request. For other usages
of the request scope it's not so well defined in EE actually.

Talking about this build-in bean though, wouldn't it be a good idea to let
JSR 375 take ownership of it? The CDI spec before proposed to the servlet
spec to take ownership of the build-in beans for the Servlet owned
artefacts (such as HttpServletRequest).

Kind regards,
Arjan Tijms
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev

Re: [weld-dev] Weld 3.0.1.Final released

2017-08-24 Thread arjan tijms
>Every Weld-enhanced object (subclass/proxy) will not implement

Should that be "will now implement"?

On Thu, Aug 24, 2017 at 6:36 PM, Matej Novotny  wrote:

> Hey, folks!
>
> Weld 3.0.1.Final is released.
> Feel free to check Weld website for further information -
> http://weld.cdi-spec.org/news/2017/08/25/weld-301Final/
>
> --
> Novotny Matej
> Red Hat Czech
> ___
> weld-dev mailing list
> weld-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
>
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev

Re: [weld-dev] Not possible to destroy normal scoped beans returned by producer method

2016-09-15 Thread arjan tijms
Hi,

The produced Foo should have been used before it's destroyed, but I'll
double check it's also used right before the destroy method is called in
the same thread. I'll try to make a simple reproducer as well if it still
doesn't work correctly then.

Kind regards,
Arjan Tijms

On Thu, Sep 15, 2016 at 8:48 AM, Martin Kouba <mko...@redhat.com> wrote:

> Hi Arjan,
>
> a simple reproducer would be helpful. There are few edge cases around
> session context and HTTP session which are problematic (e.g.
> HttpSession.invalidate()).
>
> Do you call some method on the produced Foo before you call destroy?
> Because in Weld, normal scoped instances are created lazily and so does the
> HTTP session in case of @SessionScoped.
>
> Thanks,
>
> Martin
>
> Dne 14.9.2016 v 19:14 arjan tijms napsal(a):
>
>> Hi,
>>
>> I have a simple producer:
>>
>> @Produced
>> @SessionScoped
>> public void Foo getFoo() { return new Foo());
>>
>> If I subsequently want to destroy the Bean using:
>>
>> Set<Bean> beans = beanManager.getBeans(Foo.class);
>>
>> Bean bean = (Bean) beanManager.resolve(beans);
>> Context context = beanManager.getContext(bean.getScope());
>>
>> ((AlterableContext) context).destroy(bean);
>>
>> Then in Weld 2.3.2 the destroy method of the super class
>> of org.jboss.weld.context.http.HttpSessionContextImpl is called:
>>
>> org.jboss.weld.context.AbstractContext
>>
>> Containing this code:
>>
>> @Override
>> public void destroy(Contextual contextual) {
>> if (!isActive()) {
>> throw new ContextNotActiveException();
>> }
>> checkContextInitialized();
>> if (contextual == null) {
>> throw ContextLogger.LOG.contextualIsNull();
>> }
>> final BeanStore beanStore = getBeanStore();
>> if (beanStore == null) {
>> throw ContextLogger.LOG.noBeanStoreAvailable(this);
>> }
>> BeanIdentifier id = getId(contextual);
>> ContextualInstance beanInstance = beanStore.remove(id);
>> if (beanInstance != null) {
>> RequestScopedCache.invalidate();
>> destroyContextualInstance(beanInstance);
>> }
>> }
>>
>> Now the getBeanStore() method
>> (from org.jboss.weld.context.AbstractBoundContext) returns an
>> org.jboss.weld.context.beanstore.http.LazySessionBeanStore and this bean
>> store does *not* contain the Foo bean (no key for its BeanIdentifier).
>> There are other session scoped beans there that have been instantiated
>> for the test, but Foo is missing.
>>
>> If subsequently the session is destroyed, the same destroy method is
>> called on the
>> org.jboss.weld.context.http.HttpSessionContextImpl eventually, but now
>> the getBeanStore() method returns
>> an org.jboss.weld.context.beanstore.http.EagerSessionBeanStore, and this
>> one *does* contain the Foo bean.
>>
>> The other beans that the EagerSessionBeanStore contain are equal to the
>> ones in the LazySessionBeanStore, the only difference is the Foo bean.
>>
>> Is this a bug in Weld or am I doing something wrong?
>>
>> Kind regards,
>> Arjan Tijms
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ___
>> weld-dev mailing list
>> weld-dev@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
>>
>>
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev