Posted on

How to create a WorkManager

oracle weblogic book oracle weblogic books

In this recipe, we will show how to create a new Oracle Weblogic Work Manager:

1.       From the Console left panel, select Environment | Work Manager and click on “New”: the following screen will display:

oracle weblogic book oracle weblogic books

2.       Select “Work Manager” and, in the next window, enter the Name for the Work manager (e.g. “ExampleWM”):

oracle weblogic book oracle weblogic books what is weblogic

3.       Click Next and select the target Managed server instances(s) or clusters for the Work Manager:

oracle weblogic book oracle weblogic books what is weblogic

Hit Finish. Your Work Manager is now created.

Adding Constraints to your Work Manager

As it is, the Work Manager is an empty box. No worries, we will soon add ingredients to it starting from a Min and MaxConstraints.

From the Console left panel, select Environment | Work Manager and click on “New”: this time we will select to add a new Minimum threads constraint.
The Minimum threads constraint takes an integer value that specifies the number of threads that should be assigned to this constraint to prevent server-to-server deadlocks. In the following example we are setting a minimum number of 5 threads to allocate:

oracle weblogic book oracle weblogic books what is weblogic
Return to the Work Manager menu and choose to add a new Maximum threads constraint. The Maximum threads constraint can be used to limit the maximum number of concurrent threads given to all Work Managers that share the constraint. Here we are setting a maximum limit of 20 thread units:

oracle weblogic book oracle weblogic books what is weblogic
Have you noticed the Data Source option? Actually there are cases when the administrator/developer knows that the maximum number of concurrent threads is bound by the maximum capacity of the JDBC connection pool. For example, all servlet or EJB requests that use a common JDBC connection pool are bound by its maximum pool size. In such circumstances, it is possible to define a maximum threads constraint that refers to the JDBC connection pool. This maximum threads constraint is then shared by all Work Manager affected by the connection pool size.

Now let’s assign the two constraints to the Work Manager. Select the ExampleWM and choose the “Configuration” tab. From there, you can apply the Constraints we defined to the Work Manager as depicted by the following picture:

oracle weblogic book oracle weblogic books what is weblogic
 Please note that if you check the option “Ignore Stuck Threads” Oracle Weblogic will not reckon long running processes (that is taking more than a specified time) as stuck and enable to finish the process.