Thread monitors provide a means to limit the execution time devoted to specified components and component methods. You can assign components and methods to a thread monitor to ensure that no more than a specified maximum number of threads will be active at any point executing the methods and components assigned to the monitor.
You can also use thread monitors without a limit on the number of threads. Doing so allows you to use the monitor trace properties to record performance data.
Alternatives to thread monitors
As an alternative to configuring thread monitors to govern
component load, you can configure response-time threshold monitoring
for your application components or network listeners. For more information,
see “Configuring threshold monitoring for components”
Creating or configuring a thread monitor
Follow the instructions in “Monitoring threads” in Chapter 3, “Creating and Configuring Servers,” in the System Administration Guide.
Assigning a component or method to a thread monitor
Create a user configuration script that configures the component properties and calls the <threadMonitor> Ant task. For example:.
<setProperties component="ejb.components.myjar.MyCompRemote" merge="true”> <threadMonitor name="MyMonitor"/> </setProperties>
The threadMonitor
value
specifies the thread monitor that must be acquired by new requests
when the average response time exceeds the maximum. The component
value
specifies the name of the DJC component that runs the application
component that you want to monitor. Set this depending on the application
component type, as follows:
For enterprise JavaBeans components, specify the DJC component that corresponds to the remote or local interface. If configuring an entity bean with finder methods that perform heavy processing, consider applying the same thread monitor configuration to the DJC component that corresponds to the home interface. You can read the DJC component names from the EJB module’s Ant configuration file that was generated by deployment.
For CORBA and PowerBuilder components, specify the
DJC component that corresponds to the remote interface of the EJB
session bean that wraps your component. This name is ejb.components.package.componentRemote
,
where package is the CORBA package name, and component is
the component name.
For Web components, specify the DJC component that corresponds to the servlet or JSP that the settings apply to. You can read the DJC component names from the Web application’s Ant configuration file that was generated by deployment.