You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/04/10 09:21:43 UTC

Lazy flag for resources

Hi guys,

cause in EE 7 there are default resources but I'm think (sure for my
side/case) that we don't want to create them by default I added a Lazy flag
we can use to create the resource (bind to jndi) without instantiating it.
It mitigates the effect of having it. The effect at runtime should be
negligeable if a lookup is not done each 1ms (but anyway if it is done
other issues should pop up so not a big deal).

I set it to false for ee concurrency utilities beans but I'm sure there are
other usages (maybe non jta datasource we auto-create depending the
provider - another topic but for this one we could just unwrap the jta one
if needed, would avoid another resource, another pool).

Usage is quite simple:

<Resource id="..." ...>
  # super config as usual

  Lazy = [false|true]
</Resource>

Note: classloader is respected so if defined in tomee.xml, container
classloader will be used even if needed lazily in a webapp (it stays a
shared resource of course)

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

Re: Lazy flag for resources

Posted by Romain Manni-Bucau <rm...@gmail.com>.
BTW guys if you have a good idea to handle default resources of EE 7, ATM
for the few I added (ee concurrency) it forces some auto linking for
nothing. Of course we have a flag to skip it but not super happy to have to
set it in most app to be compliant by default.

wdyt?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-04-10 9:21 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hi guys,
>
> cause in EE 7 there are default resources but I'm think (sure for my
> side/case) that we don't want to create them by default I added a Lazy flag
> we can use to create the resource (bind to jndi) without instantiating it.
> It mitigates the effect of having it. The effect at runtime should be
> negligeable if a lookup is not done each 1ms (but anyway if it is done
> other issues should pop up so not a big deal).
>
> I set it to false for ee concurrency utilities beans but I'm sure there
> are other usages (maybe non jta datasource we auto-create depending the
> provider - another topic but for this one we could just unwrap the jta one
> if needed, would avoid another resource, another pool).
>
> Usage is quite simple:
>
> <Resource id="..." ...>
>   # super config as usual
>
>   Lazy = [false|true]
> </Resource>
>
> Note: classloader is respected so if defined in tomee.xml, container
> classloader will be used even if needed lazily in a webapp (it stays a
> shared resource of course)
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>