-
1. Re: How to access ManagedExecutorService (JSR-236)
ctomc Aug 28, 2013 11:49 AM (in response to juergen.zimmermann)Are you using latest master?
Support for JSR-236 was merged into master today.
-
2. Re: How to access ManagedExecutorService (JSR-236)
juergen.zimmermann Aug 28, 2013 11:58 AM (in response to ctomc)I compiled the master about 3 h ago and saw the the commit message "WFLY-237: integrates JSR 236 RI into EE module" for the maven modules ee and ejb.
-
3. Re: How to access ManagedExecutorService (JSR-236)
ctomc Aug 28, 2013 5:41 PM (in response to juergen.zimmermann) -
4. Re: How to access ManagedExecutorService (JSR-236)
jaikiran Aug 28, 2013 10:07 PM (in response to juergen.zimmermann)Well, the field being null is suspicious since at least you would have run into a deployment error saying that the @Resource isn't recognized. Where exactly are you injecting this field? If it's some class which isn't considered as a managed component then it won't be injected.
-
5. Re: How to access ManagedExecutorService (JSR-236)
emmartins Aug 29, 2013 9:29 AM (in response to juergen.zimmermann)Can you please confirm that the ee subsystem configuration now points to 2.0 and includes the <concurrent/> element?
-
6. Re: How to access ManagedExecutorService (JSR-236)
emmartins Aug 29, 2013 9:40 AM (in response to juergen.zimmermann)Btw, your injection code should work fine, any @Resource that has no specific lookup attribute, whatever is the name, points to the default managed executor service, which should be installed if the ee subsystem configuration is ok.
-
7. Re: Re: How to access ManagedExecutorService (JSR-236)
juergen.zimmermann Aug 30, 2013 10:18 AM (in response to emmartins)Today I compiled the latest WildFly master again. The issue is still there.
The declaration of the ee subsystem in standalone.xml:
<subsystem xmlns="urn:jboss:domain:ee:2.0">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
<concurrent>
<default-context-service/>
<default-managed-thread-factory/>
<default-managed-executor-service hung-task-threshold="60000" core-threads="5" max-threads="25" keepalive-time="5000"/>
<default-managed-scheduled-executor-service hung-task-threshold="60000" core-threads="2" keepalive-time="3000"/>
</concurrent>
</subsystem>
The code fragment where I'm running in a NPE:
@ApplicationScoped
public class KundeObserver {
@Resource
private ManagedExecutorService managedExecutorService;
public void onCreateKunde(@Observes @NeuerKunde final AbstractKunde kunde) {
if (kunde == null) {
return;
}
final Runnable sendMail = new Runnable() {
@Override
public void run() {
...
}
};
managedExecutorService.submit(sendMail); // <-- NPE
}
}
-
8. Re: Re: Re: How to access ManagedExecutorService (JSR-236)
juergen.zimmermann Aug 30, 2013 10:27 AM (in response to juergen.zimmermann)I attach the output of
jboss-cli -c /subsystem=naming/:jndi-view
-
jndi.txt.zip 1.3 KB
-
-
9. Re: How to access ManagedExecutorService (JSR-236)
jaikiran Aug 30, 2013 10:49 AM (in response to juergen.zimmermann)This looks like a bug, please file a JIRA for WFLY.
In the meantime, please see if this workaround works:
@Resource(mappedName="java:comp/DefaultManagedExecutorService")
private ManagedExecutorService managedExecutorService;
-
10. Re: Re: Re: How to access ManagedExecutorService (JSR-236)
juergen.zimmermann Aug 30, 2013 11:22 AM (in response to jaikiran)Using mappedName="java:comp/DefaultManagedExecutorService" provides an existing object:
[#WFLY-1974] @Resource ManagedExecutorService produces a null field - JBoss Issue Tracker
However, now I'm getting an IllegalStateException:
-
11. Re: Re: Re: How to access ManagedExecutorService (JSR-236)
emmartins Aug 30, 2013 12:35 PM (in response to juergen.zimmermann)Thanks, will check these out.