Hitachi

uCosminexus Application Server System Design Guide


8.6.7 Setting the method timeout in the J2EE application

This section explains the settings for method timeout in the J2EE application. The method timeout settings can help you to detect the occurrence of an infinite loop in the business processing on the Web container or EJB container, in Point 6 and Point 8. You can also forcibly cancel (method cancellation) the method that detected the timeout. For details about the method cancellation functionality, see 5.3.2 Monitoring the execution time of J2EE application in the uCosminexus Application Server Operation, Monitoring, and Linkage Guide.

The following subsections explain the concept of setting the method timeout:

When method invocation is nested in the J2EE application, specify the order for invoking the method so that a higher value can be set as the timeout value at the invocation source.

An example of setup is given below:

Figure 8‒14: Example of setup of method timeout

[Figure]

In this example, a high value is set for the method that is close to the invocation source. As a result, if timeout occurs somewhere in the method, timeout will occur sequentially from the method farthest from the client. The timeout is notified through a message. Depending on the settings, method cancellation can be automatically executed at this time.

If method timeout and method cancellation are set for the methods for executing remote invocation, you need to pay attention to the invocation order. In the method cancellation functionality, the methods that are being remotely invoked are considered to be running in the protected area. If timeout occurs first in the method closer to the invocation source, the method cannot be cancelled since the method is being remotely invoked. As shown in the above example, if you set a high value in the methods closer to the invocation source, since the timeout occurs sequentially from the methods farthest from the invocation source, the method in which timeout has occurred is not being remotely invoked. You can, therefore, definitely cancel the method.

Even if the method timeout and method cancellation are set for the methods for executing local invocation, you can integrate the timed-out method with the cancelled method by canceling sequentially from the methods farthest from the invocation source.

For details about the methods that can be used to set up the timeout value, see 5.3.4 Method Cancellation in the uCosminexus Application Server Operation, Monitoring, and Linkage Guide.

Precautions when a locally invoked method is invoked by nesting

If app or all are specified in the ejbserver.rmi.localinvocation.scope of the <param-name> tag of the Easy Setup definition file, a locally invoked method that is invoked by nesting from one method is executed in all the identical threads. At this time, note the following points:

  • If timeout and method cancellation of a method invoked by nesting fails, timeout will not occur in the other methods of the identical threads until that method is terminated.

  • When method cancellation is executed for the method that has been invoked by nesting from a timed-out method, the container cancels only the method for which method cancellation was executed. The invocation source method in which timeout has occurred will not be cancelled. As a result, even after the method is cancelled, the invoked methods will be terminated sequentially, as in the case of the normal invocation of a nested method. The timeout will also be monitored for such sequentially invoked methods.

The following figure shows the precautions in the case of nested invocation of a locally invoked method in the same thread:

Figure 8‒15: Precautions in the case of nested invocation of a locally invoked method in the same thread

[Figure]