You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by Thomas Andraschko <an...@gmail.com> on 2015/09/10 18:02:00 UTC

[Proposal] CdiManagedRunnable

Hi,

it's often required to manual activate scopes in a async threads/runnables
if you don't use JavaEE 7.
I already used this in 3-4 projects in the last 3 years.

My current API looks like:

CdiManagedRunnable - A abstract class with implements Runnable and starts
the RequestScoped via ContextControl and a new scope called ThreadScope
RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
return false per default and can be overwritten by the user.

ThreadContext - A AbstractContext implementation which a static static
ThreadLocal<ContextualStorage>

ThreadContextExtension
ThreadScoped

WDYT? Is this useful for other people too?

Regards,
Thomas

Re: [Proposal] CdiManagedRunnable

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 21 sept. 2015 01:59, "Martin Kouba" <mk...@redhat.com> a écrit :
>
> Dne 18.9.2015 v 16:28 Romain Manni-Bucau napsal(a):
>
>> Hi
>>
>> I like the idea but isnt it close enough of concurrency utilities to kind
>> of put it in this spec? There is this proxy factory which could/should
>> support scopes IMO.
>>
>> CDI has few thread requirements which is good IMO so I would put it in
the
>> "thread" spec.
>
>
> Hm, is there any "Concurrency Utilities for Java EE" update planned for
Java EE 8? I can't find any info.
>

Dont think so but spec are updated when needed so if can be a need.

> Also the feature I was talking about is targeted solely to Java SE. I
misread the original message from Thomas.
>

EE is very badly used in this spec. Think it has been used to differentiate
to se = the jvm. It is just a lib.

>
>>
>> Romain
>> Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
>>
>>> Hi Thomas,
>>>
>>> I think it's a good idea. Weld has a similar API [1], except it's
focused
>>> solely on the "thread-local-based context". We are also considering the
use
>>> of an interceptor to active/deactivate the ThreadContext per business
>>> method invocation [2].
>>>
>>> I wonder, whether this should be standardized in CDI 2.0. It seems to me
>>> that CDI SE lacks some built-in contexts. Unlike Java EE where the
built-in
>>> scopes align with the lifecycle of EE components (@RequestScoped,
>>> @SessionScoped, etc.).
>>>
>>> Martin
>>>
>>> [1]
>>>
>>>
http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
>>>
>>> [2]
>>> https://issues.jboss.org/browse/WELD-1905
>>>
>>>
>>> Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
>>>
>>>> Hi,
>>>>
>>>> it's often required to manual activate scopes in a async
threads/runnables
>>>> if you don't use JavaEE 7.
>>>> I already used this in 3-4 projects in the last 3 years.
>>>>
>>>> My current API looks like:
>>>>
>>>> CdiManagedRunnable - A abstract class with implements Runnable and
starts
>>>> the RequestScoped via ContextControl and a new scope called ThreadScope
>>>> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
>>>> return false per default and can be overwritten by the user.
>>>>
>>>> ThreadContext - A AbstractContext implementation which a static static
>>>> ThreadLocal<ContextualStorage>
>>>>
>>>> ThreadContextExtension
>>>> ThreadScoped
>>>>
>>>> WDYT? Is this useful for other people too?
>>>>
>>>> Regards,
>>>> Thomas
>>>>
>>>>
>>> --
>>> Martin Kouba
>>> Software Engineer
>>> Red Hat, Czech Republic
>>>
>>

Re: [Proposal] CdiManagedRunnable

Posted by Martin Kouba <mk...@redhat.com>.
Dne 18.9.2015 v 16:28 Romain Manni-Bucau napsal(a):
> Hi
>
> I like the idea but isnt it close enough of concurrency utilities to kind
> of put it in this spec? There is this proxy factory which could/should
> support scopes IMO.
>
> CDI has few thread requirements which is good IMO so I would put it in the
> "thread" spec.

Hm, is there any "Concurrency Utilities for Java EE" update planned for 
Java EE 8? I can't find any info.

Also the feature I was talking about is targeted solely to Java SE. I 
misread the original message from Thomas.

>
> Romain
> Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
>
>> Hi Thomas,
>>
>> I think it's a good idea. Weld has a similar API [1], except it's focused
>> solely on the "thread-local-based context". We are also considering the use
>> of an interceptor to active/deactivate the ThreadContext per business
>> method invocation [2].
>>
>> I wonder, whether this should be standardized in CDI 2.0. It seems to me
>> that CDI SE lacks some built-in contexts. Unlike Java EE where the built-in
>> scopes align with the lifecycle of EE components (@RequestScoped,
>> @SessionScoped, etc.).
>>
>> Martin
>>
>> [1]
>>
>> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
>>
>> [2]
>> https://issues.jboss.org/browse/WELD-1905
>>
>>
>> Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
>>
>>> Hi,
>>>
>>> it's often required to manual activate scopes in a async threads/runnables
>>> if you don't use JavaEE 7.
>>> I already used this in 3-4 projects in the last 3 years.
>>>
>>> My current API looks like:
>>>
>>> CdiManagedRunnable - A abstract class with implements Runnable and starts
>>> the RequestScoped via ContextControl and a new scope called ThreadScope
>>> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
>>> return false per default and can be overwritten by the user.
>>>
>>> ThreadContext - A AbstractContext implementation which a static static
>>> ThreadLocal<ContextualStorage>
>>>
>>> ThreadContextExtension
>>> ThreadScoped
>>>
>>> WDYT? Is this useful for other people too?
>>>
>>> Regards,
>>> Thomas
>>>
>>>
>> --
>> Martin Kouba
>> Software Engineer
>> Red Hat, Czech Republic
>>
>

RE: [Proposal] CdiManagedRunnable

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well fork join solution is elegant but doesnt fit yet the default case from
what i saw so executor service is still a good choice for me.
Le 19 sept. 2015 09:53, "Marvin Toll" <Ma...@gtcgroup.com> a écrit :

> The Executor Service was added by Doug Lea in Java 5.
>
>
> http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html
>
> However, in Java 7 he put in the much improved Fork Join Pool... which
> extends
>
>
> http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinPool.html
>
> He then back-ported capability to Java 7 and Java 6 from the enhanced Java
> 8 implementation:
>
>         http://g.oswego.edu/dl/concurrency-interest/
>
> However, the backport uses different packaging which makes things a bit
> awkward from a Framework perspective.
>
> _Marvin
>
> -----Original Message-----
> From: John D. Ament [mailto:johndament@apache.org]
> Sent: Saturday, September 19, 2015 12:13 PM
> To: dev@deltaspike.apache.org
> Cc: Arne Limburg <ar...@openknowledge.de>
> Subject: Re: [Proposal] CdiManagedRunnable
>
> Are you thinking that this includes an executor service impl?
> Wouldn't we need to jump to java 7?
>
> John
>
> On Sat, Sep 19, 2015 at 12:05 PM Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > I always thought a CDI frienly executor service would be nice so +1
> > for ds Le 19 sept. 2015 01:32, "Thomas Andraschko"
> > <an...@gmail.com> a écrit :
> >
> > > 1+ romain
> > > But wdyt about adding something to DS for JEE6/7 users?
> > >
> > > 2015-09-19 9:23 GMT+02:00 Arne Limburg <arne.limburg@openknowledge.de
> >:
> > >
> > > > +1
> > > > I really thought the same, when I read that proposal.
> > > >
> > > > Cheers,
> > > > Arne
> > > >
> > > > Von meinem Samsung Gerät gesendet.
> > > >
> > > >
> > > > -------- Ursprüngliche Nachricht --------
> > > > Von: Romain Manni-Bucau <rm...@gmail.com>
> > > > Datum: 18.09.2015 16:28 (GMT+01:00)
> > > > An: dev@deltaspike.apache.org
> > > > Cc: Thomas Andraschko <an...@gmail.com>
> > > > Betreff: Re: [Proposal] CdiManagedRunnable
> > > >
> > > > Hi
> > > >
> > > > I like the idea but isnt it close enough of concurrency utilities
> > > > to
> > kind
> > > > of put it in this spec? There is this proxy factory which
> > > > could/should support scopes IMO.
> > > >
> > > > CDI has few thread requirements which is good IMO so I would put
> > > > it in
> > > the
> > > > "thread" spec.
> > > >
> > > > Romain
> > > > Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
> > > >
> > > > > Hi Thomas,
> > > > >
> > > > > I think it's a good idea. Weld has a similar API [1], except
> > > > > it's
> > > focused
> > > > > solely on the "thread-local-based context". We are also
> > > > > considering
> > the
> > > > use
> > > > > of an interceptor to active/deactivate the ThreadContext per
> > > > > business method invocation [2].
> > > > >
> > > > > I wonder, whether this should be standardized in CDI 2.0. It
> > > > > seems to
> > > me
> > > > > that CDI SE lacks some built-in contexts. Unlike Java EE where
> > > > > the
> > > > built-in
> > > > > scopes align with the lifecycle of EE components
> > > > > (@RequestScoped, @SessionScoped, etc.).
> > > > >
> > > > > Martin
> > > > >
> > > > > [1]
> > > > >
> > > > >
> > > >
> > >
> > http://docs.jboss.org/weld/reference/latest/en-US/html/environments.ht
> > ml#_thread_context
> > > > >
> > > > > [2]
> > > > > https://issues.jboss.org/browse/WELD-1905
> > > > >
> > > > >
> > > > > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> > > > >
> > > > >> Hi,
> > > > >>
> > > > >> it's often required to manual activate scopes in a async
> > > > threads/runnables
> > > > >> if you don't use JavaEE 7.
> > > > >> I already used this in 3-4 projects in the last 3 years.
> > > > >>
> > > > >> My current API looks like:
> > > > >>
> > > > >> CdiManagedRunnable - A abstract class with implements Runnable
> > > > >> and
> > > > starts
> > > > >> the RequestScoped via ContextControl and a new scope called
> > > ThreadScope
> > > > >> RequestScoped is optional,
> > CdiManagedRunnable#isRequestScopedSupported
> > > > >> return false per default and can be overwritten by the user.
> > > > >>
> > > > >> ThreadContext - A AbstractContext implementation which a static
> > static
> > > > >> ThreadLocal<ContextualStorage>
> > > > >>
> > > > >> ThreadContextExtension
> > > > >> ThreadScoped
> > > > >>
> > > > >> WDYT? Is this useful for other people too?
> > > > >>
> > > > >> Regards,
> > > > >> Thomas
> > > > >>
> > > > >>
> > > > > --
> > > > > Martin Kouba
> > > > > Software Engineer
> > > > > Red Hat, Czech Republic
> > > > >
> > > >
> > >
> >
>
>

RE: [Proposal] CdiManagedRunnable

Posted by Marvin Toll <Ma...@gtcGroup.com>.
The Executor Service was added by Doug Lea in Java 5.

	http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html 

However, in Java 7 he put in the much improved Fork Join Pool... which extends 

	http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinPool.html 

He then back-ported capability to Java 7 and Java 6 from the enhanced Java 8 implementation:

 	http://g.oswego.edu/dl/concurrency-interest/ 

However, the backport uses different packaging which makes things a bit awkward from a Framework perspective.

_Marvin

-----Original Message-----
From: John D. Ament [mailto:johndament@apache.org] 
Sent: Saturday, September 19, 2015 12:13 PM
To: dev@deltaspike.apache.org
Cc: Arne Limburg <ar...@openknowledge.de>
Subject: Re: [Proposal] CdiManagedRunnable

Are you thinking that this includes an executor service impl?
Wouldn't we need to jump to java 7?

John

On Sat, Sep 19, 2015 at 12:05 PM Romain Manni-Bucau <rm...@gmail.com>
wrote:

> I always thought a CDI frienly executor service would be nice so +1 
> for ds Le 19 sept. 2015 01:32, "Thomas Andraschko" 
> <an...@gmail.com> a écrit :
>
> > 1+ romain
> > But wdyt about adding something to DS for JEE6/7 users?
> >
> > 2015-09-19 9:23 GMT+02:00 Arne Limburg <ar...@openknowledge.de>:
> >
> > > +1
> > > I really thought the same, when I read that proposal.
> > >
> > > Cheers,
> > > Arne
> > >
> > > Von meinem Samsung Gerät gesendet.
> > >
> > >
> > > -------- Ursprüngliche Nachricht --------
> > > Von: Romain Manni-Bucau <rm...@gmail.com>
> > > Datum: 18.09.2015 16:28 (GMT+01:00)
> > > An: dev@deltaspike.apache.org
> > > Cc: Thomas Andraschko <an...@gmail.com>
> > > Betreff: Re: [Proposal] CdiManagedRunnable
> > >
> > > Hi
> > >
> > > I like the idea but isnt it close enough of concurrency utilities 
> > > to
> kind
> > > of put it in this spec? There is this proxy factory which 
> > > could/should support scopes IMO.
> > >
> > > CDI has few thread requirements which is good IMO so I would put 
> > > it in
> > the
> > > "thread" spec.
> > >
> > > Romain
> > > Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
> > >
> > > > Hi Thomas,
> > > >
> > > > I think it's a good idea. Weld has a similar API [1], except 
> > > > it's
> > focused
> > > > solely on the "thread-local-based context". We are also 
> > > > considering
> the
> > > use
> > > > of an interceptor to active/deactivate the ThreadContext per 
> > > > business method invocation [2].
> > > >
> > > > I wonder, whether this should be standardized in CDI 2.0. It 
> > > > seems to
> > me
> > > > that CDI SE lacks some built-in contexts. Unlike Java EE where 
> > > > the
> > > built-in
> > > > scopes align with the lifecycle of EE components 
> > > > (@RequestScoped, @SessionScoped, etc.).
> > > >
> > > > Martin
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.ht
> ml#_thread_context
> > > >
> > > > [2]
> > > > https://issues.jboss.org/browse/WELD-1905
> > > >
> > > >
> > > > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> > > >
> > > >> Hi,
> > > >>
> > > >> it's often required to manual activate scopes in a async
> > > threads/runnables
> > > >> if you don't use JavaEE 7.
> > > >> I already used this in 3-4 projects in the last 3 years.
> > > >>
> > > >> My current API looks like:
> > > >>
> > > >> CdiManagedRunnable - A abstract class with implements Runnable 
> > > >> and
> > > starts
> > > >> the RequestScoped via ContextControl and a new scope called
> > ThreadScope
> > > >> RequestScoped is optional,
> CdiManagedRunnable#isRequestScopedSupported
> > > >> return false per default and can be overwritten by the user.
> > > >>
> > > >> ThreadContext - A AbstractContext implementation which a static
> static
> > > >> ThreadLocal<ContextualStorage>
> > > >>
> > > >> ThreadContextExtension
> > > >> ThreadScoped
> > > >>
> > > >> WDYT? Is this useful for other people too?
> > > >>
> > > >> Regards,
> > > >> Thomas
> > > >>
> > > >>
> > > > --
> > > > Martin Kouba
> > > > Software Engineer
> > > > Red Hat, Czech Republic
> > > >
> > >
> >
>


Re: [Proposal] CdiManagedRunnable

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 19 sept. 2015 09:13, "John D. Ament" <jo...@apache.org> a écrit :
>
> Are you thinking that this includes an executor service impl?

This is the working out of the box solution to me. Happy to get another
solution.

> Wouldn't we need to jump to java 7?
>

Dont think so. It is an interface so easy to proxy and we just need to wrap
runnable/callable and expose a handler to control more finely scopes than
on the executor only.

> John
>
> On Sat, Sep 19, 2015 at 12:05 PM Romain Manni-Bucau <rmannibucau@gmail.com
>
> wrote:
>
> > I always thought a CDI frienly executor service would be nice so +1 for
ds
> > Le 19 sept. 2015 01:32, "Thomas Andraschko" <andraschko.thomas@gmail.com
>
> > a
> > écrit :
> >
> > > 1+ romain
> > > But wdyt about adding something to DS for JEE6/7 users?
> > >
> > > 2015-09-19 9:23 GMT+02:00 Arne Limburg <arne.limburg@openknowledge.de
>:
> > >
> > > > +1
> > > > I really thought the same, when I read that proposal.
> > > >
> > > > Cheers,
> > > > Arne
> > > >
> > > > Von meinem Samsung Gerät gesendet.
> > > >
> > > >
> > > > -------- Ursprüngliche Nachricht --------
> > > > Von: Romain Manni-Bucau <rm...@gmail.com>
> > > > Datum: 18.09.2015 16:28 (GMT+01:00)
> > > > An: dev@deltaspike.apache.org
> > > > Cc: Thomas Andraschko <an...@gmail.com>
> > > > Betreff: Re: [Proposal] CdiManagedRunnable
> > > >
> > > > Hi
> > > >
> > > > I like the idea but isnt it close enough of concurrency utilities to
> > kind
> > > > of put it in this spec? There is this proxy factory which
could/should
> > > > support scopes IMO.
> > > >
> > > > CDI has few thread requirements which is good IMO so I would put it
in
> > > the
> > > > "thread" spec.
> > > >
> > > > Romain
> > > > Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
> > > >
> > > > > Hi Thomas,
> > > > >
> > > > > I think it's a good idea. Weld has a similar API [1], except it's
> > > focused
> > > > > solely on the "thread-local-based context". We are also
considering
> > the
> > > > use
> > > > > of an interceptor to active/deactivate the ThreadContext per
business
> > > > > method invocation [2].
> > > > >
> > > > > I wonder, whether this should be standardized in CDI 2.0. It
seems to
> > > me
> > > > > that CDI SE lacks some built-in contexts. Unlike Java EE where the
> > > > built-in
> > > > > scopes align with the lifecycle of EE components (@RequestScoped,
> > > > > @SessionScoped, etc.).
> > > > >
> > > > > Martin
> > > > >
> > > > > [1]
> > > > >
> > > > >
> > > >
> > >
> >
http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
> > > > >
> > > > > [2]
> > > > > https://issues.jboss.org/browse/WELD-1905
> > > > >
> > > > >
> > > > > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> > > > >
> > > > >> Hi,
> > > > >>
> > > > >> it's often required to manual activate scopes in a async
> > > > threads/runnables
> > > > >> if you don't use JavaEE 7.
> > > > >> I already used this in 3-4 projects in the last 3 years.
> > > > >>
> > > > >> My current API looks like:
> > > > >>
> > > > >> CdiManagedRunnable - A abstract class with implements Runnable
and
> > > > starts
> > > > >> the RequestScoped via ContextControl and a new scope called
> > > ThreadScope
> > > > >> RequestScoped is optional,
> > CdiManagedRunnable#isRequestScopedSupported
> > > > >> return false per default and can be overwritten by the user.
> > > > >>
> > > > >> ThreadContext - A AbstractContext implementation which a static
> > static
> > > > >> ThreadLocal<ContextualStorage>
> > > > >>
> > > > >> ThreadContextExtension
> > > > >> ThreadScoped
> > > > >>
> > > > >> WDYT? Is this useful for other people too?
> > > > >>
> > > > >> Regards,
> > > > >> Thomas
> > > > >>
> > > > >>
> > > > > --
> > > > > Martin Kouba
> > > > > Software Engineer
> > > > > Red Hat, Czech Republic
> > > > >
> > > >
> > >
> >

Re: [Proposal] CdiManagedRunnable

Posted by "John D. Ament" <jo...@apache.org>.
Are you thinking that this includes an executor service impl?
Wouldn't we need to jump to java 7?

John

On Sat, Sep 19, 2015 at 12:05 PM Romain Manni-Bucau <rm...@gmail.com>
wrote:

> I always thought a CDI frienly executor service would be nice so +1 for ds
> Le 19 sept. 2015 01:32, "Thomas Andraschko" <an...@gmail.com>
> a
> écrit :
>
> > 1+ romain
> > But wdyt about adding something to DS for JEE6/7 users?
> >
> > 2015-09-19 9:23 GMT+02:00 Arne Limburg <ar...@openknowledge.de>:
> >
> > > +1
> > > I really thought the same, when I read that proposal.
> > >
> > > Cheers,
> > > Arne
> > >
> > > Von meinem Samsung Gerät gesendet.
> > >
> > >
> > > -------- Ursprüngliche Nachricht --------
> > > Von: Romain Manni-Bucau <rm...@gmail.com>
> > > Datum: 18.09.2015 16:28 (GMT+01:00)
> > > An: dev@deltaspike.apache.org
> > > Cc: Thomas Andraschko <an...@gmail.com>
> > > Betreff: Re: [Proposal] CdiManagedRunnable
> > >
> > > Hi
> > >
> > > I like the idea but isnt it close enough of concurrency utilities to
> kind
> > > of put it in this spec? There is this proxy factory which could/should
> > > support scopes IMO.
> > >
> > > CDI has few thread requirements which is good IMO so I would put it in
> > the
> > > "thread" spec.
> > >
> > > Romain
> > > Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
> > >
> > > > Hi Thomas,
> > > >
> > > > I think it's a good idea. Weld has a similar API [1], except it's
> > focused
> > > > solely on the "thread-local-based context". We are also considering
> the
> > > use
> > > > of an interceptor to active/deactivate the ThreadContext per business
> > > > method invocation [2].
> > > >
> > > > I wonder, whether this should be standardized in CDI 2.0. It seems to
> > me
> > > > that CDI SE lacks some built-in contexts. Unlike Java EE where the
> > > built-in
> > > > scopes align with the lifecycle of EE components (@RequestScoped,
> > > > @SessionScoped, etc.).
> > > >
> > > > Martin
> > > >
> > > > [1]
> > > >
> > > >
> > >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
> > > >
> > > > [2]
> > > > https://issues.jboss.org/browse/WELD-1905
> > > >
> > > >
> > > > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> > > >
> > > >> Hi,
> > > >>
> > > >> it's often required to manual activate scopes in a async
> > > threads/runnables
> > > >> if you don't use JavaEE 7.
> > > >> I already used this in 3-4 projects in the last 3 years.
> > > >>
> > > >> My current API looks like:
> > > >>
> > > >> CdiManagedRunnable - A abstract class with implements Runnable and
> > > starts
> > > >> the RequestScoped via ContextControl and a new scope called
> > ThreadScope
> > > >> RequestScoped is optional,
> CdiManagedRunnable#isRequestScopedSupported
> > > >> return false per default and can be overwritten by the user.
> > > >>
> > > >> ThreadContext - A AbstractContext implementation which a static
> static
> > > >> ThreadLocal<ContextualStorage>
> > > >>
> > > >> ThreadContextExtension
> > > >> ThreadScoped
> > > >>
> > > >> WDYT? Is this useful for other people too?
> > > >>
> > > >> Regards,
> > > >> Thomas
> > > >>
> > > >>
> > > > --
> > > > Martin Kouba
> > > > Software Engineer
> > > > Red Hat, Czech Republic
> > > >
> > >
> >
>

Re: [Proposal] CdiManagedRunnable

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I always thought a CDI frienly executor service would be nice so +1 for ds
Le 19 sept. 2015 01:32, "Thomas Andraschko" <an...@gmail.com> a
écrit :

> 1+ romain
> But wdyt about adding something to DS for JEE6/7 users?
>
> 2015-09-19 9:23 GMT+02:00 Arne Limburg <ar...@openknowledge.de>:
>
> > +1
> > I really thought the same, when I read that proposal.
> >
> > Cheers,
> > Arne
> >
> > Von meinem Samsung Gerät gesendet.
> >
> >
> > -------- Ursprüngliche Nachricht --------
> > Von: Romain Manni-Bucau <rm...@gmail.com>
> > Datum: 18.09.2015 16:28 (GMT+01:00)
> > An: dev@deltaspike.apache.org
> > Cc: Thomas Andraschko <an...@gmail.com>
> > Betreff: Re: [Proposal] CdiManagedRunnable
> >
> > Hi
> >
> > I like the idea but isnt it close enough of concurrency utilities to kind
> > of put it in this spec? There is this proxy factory which could/should
> > support scopes IMO.
> >
> > CDI has few thread requirements which is good IMO so I would put it in
> the
> > "thread" spec.
> >
> > Romain
> > Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
> >
> > > Hi Thomas,
> > >
> > > I think it's a good idea. Weld has a similar API [1], except it's
> focused
> > > solely on the "thread-local-based context". We are also considering the
> > use
> > > of an interceptor to active/deactivate the ThreadContext per business
> > > method invocation [2].
> > >
> > > I wonder, whether this should be standardized in CDI 2.0. It seems to
> me
> > > that CDI SE lacks some built-in contexts. Unlike Java EE where the
> > built-in
> > > scopes align with the lifecycle of EE components (@RequestScoped,
> > > @SessionScoped, etc.).
> > >
> > > Martin
> > >
> > > [1]
> > >
> > >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
> > >
> > > [2]
> > > https://issues.jboss.org/browse/WELD-1905
> > >
> > >
> > > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> > >
> > >> Hi,
> > >>
> > >> it's often required to manual activate scopes in a async
> > threads/runnables
> > >> if you don't use JavaEE 7.
> > >> I already used this in 3-4 projects in the last 3 years.
> > >>
> > >> My current API looks like:
> > >>
> > >> CdiManagedRunnable - A abstract class with implements Runnable and
> > starts
> > >> the RequestScoped via ContextControl and a new scope called
> ThreadScope
> > >> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
> > >> return false per default and can be overwritten by the user.
> > >>
> > >> ThreadContext - A AbstractContext implementation which a static static
> > >> ThreadLocal<ContextualStorage>
> > >>
> > >> ThreadContextExtension
> > >> ThreadScoped
> > >>
> > >> WDYT? Is this useful for other people too?
> > >>
> > >> Regards,
> > >> Thomas
> > >>
> > >>
> > > --
> > > Martin Kouba
> > > Software Engineer
> > > Red Hat, Czech Republic
> > >
> >
>

Re: [Proposal] CdiManagedRunnable

Posted by Thomas Andraschko <an...@gmail.com>.
1+ romain
But wdyt about adding something to DS for JEE6/7 users?

2015-09-19 9:23 GMT+02:00 Arne Limburg <ar...@openknowledge.de>:

> +1
> I really thought the same, when I read that proposal.
>
> Cheers,
> Arne
>
> Von meinem Samsung Gerät gesendet.
>
>
> -------- Ursprüngliche Nachricht --------
> Von: Romain Manni-Bucau <rm...@gmail.com>
> Datum: 18.09.2015 16:28 (GMT+01:00)
> An: dev@deltaspike.apache.org
> Cc: Thomas Andraschko <an...@gmail.com>
> Betreff: Re: [Proposal] CdiManagedRunnable
>
> Hi
>
> I like the idea but isnt it close enough of concurrency utilities to kind
> of put it in this spec? There is this proxy factory which could/should
> support scopes IMO.
>
> CDI has few thread requirements which is good IMO so I would put it in the
> "thread" spec.
>
> Romain
> Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :
>
> > Hi Thomas,
> >
> > I think it's a good idea. Weld has a similar API [1], except it's focused
> > solely on the "thread-local-based context". We are also considering the
> use
> > of an interceptor to active/deactivate the ThreadContext per business
> > method invocation [2].
> >
> > I wonder, whether this should be standardized in CDI 2.0. It seems to me
> > that CDI SE lacks some built-in contexts. Unlike Java EE where the
> built-in
> > scopes align with the lifecycle of EE components (@RequestScoped,
> > @SessionScoped, etc.).
> >
> > Martin
> >
> > [1]
> >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
> >
> > [2]
> > https://issues.jboss.org/browse/WELD-1905
> >
> >
> > Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> >
> >> Hi,
> >>
> >> it's often required to manual activate scopes in a async
> threads/runnables
> >> if you don't use JavaEE 7.
> >> I already used this in 3-4 projects in the last 3 years.
> >>
> >> My current API looks like:
> >>
> >> CdiManagedRunnable - A abstract class with implements Runnable and
> starts
> >> the RequestScoped via ContextControl and a new scope called ThreadScope
> >> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
> >> return false per default and can be overwritten by the user.
> >>
> >> ThreadContext - A AbstractContext implementation which a static static
> >> ThreadLocal<ContextualStorage>
> >>
> >> ThreadContextExtension
> >> ThreadScoped
> >>
> >> WDYT? Is this useful for other people too?
> >>
> >> Regards,
> >> Thomas
> >>
> >>
> > --
> > Martin Kouba
> > Software Engineer
> > Red Hat, Czech Republic
> >
>

AW: [Proposal] CdiManagedRunnable

Posted by Arne Limburg <ar...@openknowledge.de>.
+1
I really thought the same, when I read that proposal.

Cheers,
Arne

Von meinem Samsung Gerät gesendet.


-------- Ursprüngliche Nachricht --------
Von: Romain Manni-Bucau <rm...@gmail.com>
Datum: 18.09.2015 16:28 (GMT+01:00)
An: dev@deltaspike.apache.org
Cc: Thomas Andraschko <an...@gmail.com>
Betreff: Re: [Proposal] CdiManagedRunnable

Hi

I like the idea but isnt it close enough of concurrency utilities to kind
of put it in this spec? There is this proxy factory which could/should
support scopes IMO.

CDI has few thread requirements which is good IMO so I would put it in the
"thread" spec.

Romain
Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :

> Hi Thomas,
>
> I think it's a good idea. Weld has a similar API [1], except it's focused
> solely on the "thread-local-based context". We are also considering the use
> of an interceptor to active/deactivate the ThreadContext per business
> method invocation [2].
>
> I wonder, whether this should be standardized in CDI 2.0. It seems to me
> that CDI SE lacks some built-in contexts. Unlike Java EE where the built-in
> scopes align with the lifecycle of EE components (@RequestScoped,
> @SessionScoped, etc.).
>
> Martin
>
> [1]
>
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
>
> [2]
> https://issues.jboss.org/browse/WELD-1905
>
>
> Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
>
>> Hi,
>>
>> it's often required to manual activate scopes in a async threads/runnables
>> if you don't use JavaEE 7.
>> I already used this in 3-4 projects in the last 3 years.
>>
>> My current API looks like:
>>
>> CdiManagedRunnable - A abstract class with implements Runnable and starts
>> the RequestScoped via ContextControl and a new scope called ThreadScope
>> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
>> return false per default and can be overwritten by the user.
>>
>> ThreadContext - A AbstractContext implementation which a static static
>> ThreadLocal<ContextualStorage>
>>
>> ThreadContextExtension
>> ThreadScoped
>>
>> WDYT? Is this useful for other people too?
>>
>> Regards,
>> Thomas
>>
>>
> --
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
>

Re: [Proposal] CdiManagedRunnable

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

I like the idea but isnt it close enough of concurrency utilities to kind
of put it in this spec? There is this proxy factory which could/should
support scopes IMO.

CDI has few thread requirements which is good IMO so I would put it in the
"thread" spec.

Romain
Le 18 sept. 2015 07:23, "Martin Kouba" <mk...@redhat.com> a écrit :

> Hi Thomas,
>
> I think it's a good idea. Weld has a similar API [1], except it's focused
> solely on the "thread-local-based context". We are also considering the use
> of an interceptor to active/deactivate the ThreadContext per business
> method invocation [2].
>
> I wonder, whether this should be standardized in CDI 2.0. It seems to me
> that CDI SE lacks some built-in contexts. Unlike Java EE where the built-in
> scopes align with the lifecycle of EE components (@RequestScoped,
> @SessionScoped, etc.).
>
> Martin
>
> [1]
>
> http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context
>
> [2]
> https://issues.jboss.org/browse/WELD-1905
>
>
> Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
>
>> Hi,
>>
>> it's often required to manual activate scopes in a async threads/runnables
>> if you don't use JavaEE 7.
>> I already used this in 3-4 projects in the last 3 years.
>>
>> My current API looks like:
>>
>> CdiManagedRunnable - A abstract class with implements Runnable and starts
>> the RequestScoped via ContextControl and a new scope called ThreadScope
>> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
>> return false per default and can be overwritten by the user.
>>
>> ThreadContext - A AbstractContext implementation which a static static
>> ThreadLocal<ContextualStorage>
>>
>> ThreadContextExtension
>> ThreadScoped
>>
>> WDYT? Is this useful for other people too?
>>
>> Regards,
>> Thomas
>>
>>
> --
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
>

Re: [Proposal] CdiManagedRunnable

Posted by Martin Kouba <mk...@redhat.com>.
Hi Thomas,

I think it's a good idea. Weld has a similar API [1], except it's 
focused solely on the "thread-local-based context". We are also 
considering the use of an interceptor to active/deactivate the 
ThreadContext per business method invocation [2].

I wonder, whether this should be standardized in CDI 2.0. It seems to me 
that CDI SE lacks some built-in contexts. Unlike Java EE where the 
built-in scopes align with the lifecycle of EE components 
(@RequestScoped, @SessionScoped, etc.).

Martin

[1]
http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_thread_context

[2]
https://issues.jboss.org/browse/WELD-1905


Dne 10.9.2015 v 18:02 Thomas Andraschko napsal(a):
> Hi,
>
> it's often required to manual activate scopes in a async threads/runnables
> if you don't use JavaEE 7.
> I already used this in 3-4 projects in the last 3 years.
>
> My current API looks like:
>
> CdiManagedRunnable - A abstract class with implements Runnable and starts
> the RequestScoped via ContextControl and a new scope called ThreadScope
> RequestScoped is optional, CdiManagedRunnable#isRequestScopedSupported
> return false per default and can be overwritten by the user.
>
> ThreadContext - A AbstractContext implementation which a static static
> ThreadLocal<ContextualStorage>
>
> ThreadContextExtension
> ThreadScoped
>
> WDYT? Is this useful for other people too?
>
> Regards,
> Thomas
>

-- 
Martin Kouba
Software Engineer
Red Hat, Czech Republic