Weblogic WorkManager policies across war to ejb-jar
I have a servlet that is employing the defaultWM for Weblogic. This servlet in turn calls an ejb. This ejb is associated with a different WM ( WM_EJB ). What I'd like to know, when a thread comes in to be processed via the servlet, does the servlet use the defaultWM and then the carry the same WM context to 开发者_如何学Gothe ejb call? or is there a switch?
i.e.
- External request to ServletA -- ServletA is configured with DefaultWM
- ServletA processes request and call EJB.helloWorld()
- EJB.helloWOrld() is configured with WM_EJB workmanager
Does the entire process use the DefaultWM or does it switch on the call to EJB.helloWorld()
My apologies if this was answered somewhere else, i couldn't find an answer to WM flow.
I've been doing some investigations on this and my response is that Weblogic *will switch over from DefaultWM to the component's WorkManager say EJB_WM* if one is defined.
Remember the execute thread remains the same - so once a request has come in, the same thread will execute the servlet, and then the EJB.
In my sample app, I'm firing 50 concurrent calls to an index.jsp, whereas in the weblogic-ejb-jar.xml
, I've defined this constraint for the EJB alone
<work-manager>
<name>WorkManagerA</name>
<max-threads-constraint>
<name>MyMaxThreadCount</name>
<count>1</count>
</max-threads-constraint>
</work-manager>
I can see the logs showing 2 parallel calls in different threads 6 and 8 within index.jsp
INDEX.JSP - Current ThreadName Is: [ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'
INDEX.JSP - Current ThreadName Is: [ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'
Now some more log statements
Calling EJB from index.jsp 1317985368088[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'
Start EJB 1317985368088[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'
end EJB 1317985368088[ACTIVE] ExecuteThread: '6' for queue: 'weblogic.kernel.Default (self-tuning)'
Calling EJB from index.jsp 1317985368088[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'
Start EJB 1317985368104[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'
end EJB 1317985368104[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'
As the timestamps (System.currentTimeMillis()) show, index.jsp has been called at the same time 1317985368088 from Threads 6 and 8, however the System.out.println statements called "Start EJB" and "end EJB" have a different timestamp for Threads 6 and 8. These are from within the EJB.
This shows the EJB WorkManager is doing it's task of constraining the Parallel Thread Count to only 1 at a time
精彩评论