java - 如何在WebLogic 8中使用线程池?

标签 java multithreading weblogic threadpool weblogic8.x

如何在 WebLogic 8.1.6 中从执行队列(=线程池)获取/使用/返回线程?

最佳答案

据我所知,不,这是不可能的,你无法直接获取线程。相反,请将执行队列分配给 Servlet、JSP、EJB 或 RMI 对象。

Weblogic let you assign an execute queue to Servlets, JSPs, EJBs, and RMI objects. In order to associate an execute queue with a servlet (or JSP), you need to specify the wl-dispatch-policy initialization parameter for the servlet (or JSP) in the web.xml descriptor file. The following code sample shows how to assign the execute queue mySpecialQueue to a JSP page:

<!-- web.xml entry -->
<servlet>
    <servlet-name>MyServlet</servlet-name>
    <jsp-file>/critical.jsp</jsp-file>
    <init-param>
        <param-name>wl-dispatch-policy</param-name>
        <param-value>mySpecialQueue</param-value>
    </init-param>
</servlet>

In order to assign an execute queue to an RMI object, you must specify the -dispatchPolicy option when using Weblogic's RMI compiler (rmic). Here's how you would assign the execute queue mySpecialQueue to an RMI object:

java weblogic.rmic -dispatchPolicy mySpecialQueue ...
 In the same way, use the `-dispatchPolicy` option when invoking

Weblogic's EJB compiler to assign the execute queute to an EJB. Weblogic's EJB compiler implicitly passes the -dipatchPolicy argument to the underlying RMI compiler. In Weblogic 8.1, use the dispatch-policy element in the EJB's weblogic-ejb-jar.xml descriptor to set the execute queue:

<!-- weblogic-ejb-jar.xml descriptor -->
<weblogic-enterprise-bean>
    <ejb-name>myEJB</ejb-name>
    ...
    <dispatch-policy>myEJBQueue</dispatch-policy>
</weblogic-enterprise-bean>

Custom execute queues are supported for all EJB types - session beans, entity beans, and MDBs.

At runtime, Weblogic allocates worker threads for your servlets, JSPs, EJBs, and RMI objects from their configured execute queues, thereby guaranteeing that selected objects in your application have access to a fixed number of server threads. For those objects for which no execute queue is assigned, the threads will be allocated from the server's default execute queue.

关于java - 如何在WebLogic 8中使用线程池?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1601633/

相关文章:

Android:Viewpager、线程和方向改变

java - Weblogic主机名验证异常

java - 不使用 Oracle jar 的 WebLogic 客户端

java - 在 Springframework 2.5.6 中是否有可能在 ="session"范围内创建 session 创建对象

c# - 在 DOS 屏幕上显示进程百分比

java - 最大的质因数程序需要 aaaages - Java

Java的yield()方法不起作用。Netbeans Ubuntu 10.04

c# - 添加到并发集合

java - 如何使面向对象的java项目完全通用

java - 启动 WLDF 控制台扩展时出现问题