Weblogic WorkManager 策略跨越战争到 ejb-jar

发布于 2024-12-07 22:06:39 字数 430 浏览 0 评论 0原文

我有一个 Servlet,它使用 Weblogic 的默认 WM。该servlet 依次调用ejb。该 ejb 与不同的 WM (WM_EJB) 关联。我想知道的是,当线程通过 servlet 进行处理时,servlet 是否使用 defaultWM,然后将相同的 WM 上下文传递给 ejb 调用?或者有一个开关吗?

  1. 对 ServletA 的外部请求 - ServletA 配置为 DefaultWM
  2. ServletA 处理请求并调用 EJB.helloWorld()
  3. EJB.helloWOrld() 配置为 WM_EJB workmanager

整个进程是否使用 DefaultWM 还是切换到对 EJB.helloWorld 的调用()

如果在其他地方回答了这个问题,我很抱歉,我找不到 WM 流的答案。

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 the ejb call? or is there a switch?

i.e.

  1. External request to ServletA -- ServletA is configured with DefaultWM
  2. ServletA processes request and call EJB.helloWorld()
  3. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幻想少年梦 2024-12-14 22:06:39

我一直在对此进行一些调查,我的回应是 Weblogic *将从 DefaultWM 切换到组件的 WorkManager(如 EJB_WM*)(如果已定义)。

请记住,执行线程保持不变 - 因此一旦收到请求,同一个线程将执行 servlet,然后执行 EJB。

在我的示例应用程序中,我向 index.jsp 发起 50 个并发调用,而在 weblogic-ejb-jar.xml 中,我单独为 EJB 定义了此约束,

<work-manager>
       <name>WorkManagerA</name>
       <max-threads-constraint>
          <name>MyMaxThreadCount</name>
          <count>1</count>
       </max-threads-constraint>
    </work-manager>

我可以看到日志显示 index.jsp 中不同线程 6 和 8 中的 2 个并行调用

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)'

现在还有一些日志语句

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)'

正如时间戳 (System.currentTimeMillis()) 所示,index.jsp 已同时被调用1317985368088 来自线程 6 和 8,但是
名为“Start EJB”和“end EJB”的 System.out.println 语句对于线程 6 和 8 有不同的时间戳。这些语句来自 EJB 内部。

这表明 EJB WorkManager 正在执行将并行线程计数一次限制为 1 的任务

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文