views:

1148

answers:

1

How is it possible to get/use/return a thread from an execute queue ( = thread pool) in WebLogic 8.1.6?

+1  A: 

AFAIK, no, this is not possible, you can't get a thread directly. Instead, assign an execute queue to a Servlet, JSP, EJB, or RMI object.

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.

Pascal Thivent