clemensx
2018-07-16 10:31:13 UTC
Hi,
we have problems using ManagedExecutorService resources in tomee 7.0.4
Using default ManagedExecutorService works fine, but if we try to define a
new pool with more threads we cannot access the service
In resource.xml we do this:
<Resource id="FooManagedExecutorService" type="ManagedExecutorService">
Core = 40
Max = 50
KeepAlive = 5 s
Queue = 150
ThreadFactory = org.apache.openejb.threads.impl.ManagedThreadFactoryImpl
Lazy = true
</Resource>
But then we cannot even get the default service injected in our stateful
session bean:
@Resource(name="java:comp/DefaultManagedExecutorService")
private ManagedExecutorService execService;
will yield a null execService.
@Resource(name="FooManagedExecutorService")
private ManagedExecutorService execService;
same with trying to access our own resource.
Getting the reference programmatically via
execService = (ManagedExecutorService)
sessionContext.lookup(“openejb:Resource/FooManagedExecutorService”);
also gives null.
In the server startup logs we see several mentions of our service:
for all beans:
[CONTAINER] OpenEJB.startup.config INFO Auto-linking resource-ref
'openejb/Resource/ROOT/FooManagedExecutorService' in bean ProductDao to
Resource(id=FooManagedExecutorService)
3 times this info (no idea why the container is creating the resource 3
times):
[CONTAINER] OpenEJB.startup.service INFO Creating
Resource(id=ROOT/FooManagedExecutorService,
aliases=FooManagedExecutorService)
[CONTAINER] OpenEJB.startup.config INFO Configuring
Service(id=ROOT/FooManagedExecutorService, type=Resource,
provider-id=Default Executor Service)
Thanks for any ideas/workarounds
clemens
--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
we have problems using ManagedExecutorService resources in tomee 7.0.4
Using default ManagedExecutorService works fine, but if we try to define a
new pool with more threads we cannot access the service
In resource.xml we do this:
<Resource id="FooManagedExecutorService" type="ManagedExecutorService">
Core = 40
Max = 50
KeepAlive = 5 s
Queue = 150
ThreadFactory = org.apache.openejb.threads.impl.ManagedThreadFactoryImpl
Lazy = true
</Resource>
But then we cannot even get the default service injected in our stateful
session bean:
@Resource(name="java:comp/DefaultManagedExecutorService")
private ManagedExecutorService execService;
will yield a null execService.
@Resource(name="FooManagedExecutorService")
private ManagedExecutorService execService;
same with trying to access our own resource.
Getting the reference programmatically via
execService = (ManagedExecutorService)
sessionContext.lookup(“openejb:Resource/FooManagedExecutorService”);
also gives null.
In the server startup logs we see several mentions of our service:
for all beans:
[CONTAINER] OpenEJB.startup.config INFO Auto-linking resource-ref
'openejb/Resource/ROOT/FooManagedExecutorService' in bean ProductDao to
Resource(id=FooManagedExecutorService)
3 times this info (no idea why the container is creating the resource 3
times):
[CONTAINER] OpenEJB.startup.service INFO Creating
Resource(id=ROOT/FooManagedExecutorService,
aliases=FooManagedExecutorService)
[CONTAINER] OpenEJB.startup.config INFO Configuring
Service(id=ROOT/FooManagedExecutorService, type=Resource,
provider-id=Default Executor Service)
Thanks for any ideas/workarounds
clemens
--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html