简体   繁体   English

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

[英]How to use thread pool in WebLogic 8?

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

AFAIK, no, this is not possible, you can't get a thread directly. AFAIK,不,这不可能,您无法直接获得线程。 Instead, assign an execute queue to a Servlet, JSP, EJB, or RMI object. 而是将执行队列分配给Servlet,JSP,EJB或RMI对象。

Weblogic let you assign an execute queue to Servlets, JSPs, EJBs, and RMI objects. Weblogic允许您将执行队列分配给Servlet,JSP,EJB和RMI对象。 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. 为了将执行队列与servlet(或JSP)相关联,您需要在web.xml描述符文件中为servlet(或JSP)指定wl-dispatch-policy初始化参数。 The following code sample shows how to assign the execute queue mySpecialQueue to a JSP page: 以下代码示例显示如何将执行队列mySpecialQueue分配给JSP页面:

 <!-- 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). 为了将执行队列分配给RMI对象,在使用Weblogic的RMI编译器(rmic)时,必须指定-dispatchPolicy选项。 Here's how you would assign the execute queue mySpecialQueue to an RMI object: 这是将执行队列mySpecialQueue分配给RMI对象的方法:

 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的EJB编译器,用于将执行队列分配给EJB。 Weblogic's EJB compiler implicitly passes the -dipatchPolicy argument to the underlying RMI compiler. Weblogic的EJB编译器将-dipatchPolicy参数隐式传递给基础RMI编译器。 In Weblogic 8.1, use the dispatch-policy element in the EJB's weblogic-ejb-jar.xml descriptor to set the execute queue: 在Weblogic 8.1中,使用EJB的weblogic-ejb-jar.xml描述符中的dispatch-policy元素设置执行队列:

 <!-- 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. 所有EJB类型(会话Bean,实体Bean和MDB)都支持定制执行队列。

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. 在运行时,Weblogic从配置的执行队列中为Servlet,JSP,EJB和RMI对象分配工作线程,从而确保应用程序中的选定对象可以访问固定数量的服务器线程。 For those objects for which no execute queue is assigned, the threads will be allocated from the server's default execute queue. 对于那些未分配执行队列的对象,将从服务器的默认执行队列中分配线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM