Hitachi

uCosminexus Application Server Compatibility Guide


5.6.2 Setting the communication timeout when sending and receiving a response

This section explains the setting of communication timeout for sending and receiving responses when the Web server integration functionality is used. The following figure shows the locations to set the communication timeout for sending and receiving responses:

Figure 5‒19: Locations to set the communication timeout for sending and receiving responses (when the Web server integration functionality is used)

[Figure]

When you use the Web server integration functionality, set the communication timeout at the locations marked with a O sign in the figure. The locations to set the communication timeout are explained below. The numbers in the figure correspond to the numbers in the following explanation:

  1. When a response is sent by the Web container (Web container - redirector)

    Set the communication timeout when a response is sent from the Web container to the redirector. Set the communication timeout in the Web container.

    For details on the failures that you can detect by setting the communication timeout when a response is sent by the Web container, see (1) When a response is sent by the Web container explained below.

  2. When a response is received by the redirector (Web container - redirector)

    Set communication timeout when the redirector receives a response from the Web container. Set the communication timeout in the redirector.

    For details on the failures that you can detect by setting communication timeout when response is received by the redirector, see (2) When a response is received by the redirector explained below.

  3. When a response is sent by the Web server (Web server - Client)

    Set communication timeout when a response is sent from the Web server to the client. Set the communication timeout in the Web server.

    For details on the failures that you can be detect by setting the communication timeout when a response is sent by the Web server, see (3) When a response is sent by the Web server explained below.

Organization of this subsection

(1) When a response is sent by the Web container

You can set a timeout period in the Web container, for sending a response to the redirector. You can detect the occurrence of failure in the redirector using the communication timeout that was set up. You can detect the following failures:

Detectable failures
  • The host on which the redirector is running is down.

  • A network failure occurs between the Web container and the redirector.

When the communication timeout occurs, KDJE39507-E (timeout occurred when sending a response) is output to the message log. The following table describes the conditions for occurrence of communication timeout and the operations after the timeout occurs.

Table 5‒14: Conditions for occurrence of communication timeout and the operations after occurrence

Timing of occurrence of communication timeout

Operation of the method after occurrence of communication timeout

Operation of servlets or JSPs after occurrence of communication timeout

When response data is sent to the client by using the method of javax.servlet.ServletOutputStream class acquired by getOutputStream method of javax.servlet.ServletResponse class, in the servlet

Exception java.net.SocketTimeoutException occurs.

Since the connection to the redirector is closed, you cannot send or receive the request data and the response data.

When response data is sent to the client by using the method of java.io.PrintWriter class acquired by getWriter method of javax.servlet.ServletResponse class, in the servlet

The send process is interrupted and returned.

  • The checkError method of java.io.PrintWriter class returns true.

  • Since the connection to the redirector is closed, you cannot send or receive the request data and the response data.

When response data is sent to the client by using the method of javax.servlet.jsp.JspWriter class, in JSP

Exception java.net.SocketTimeoutException occurs.

Since the connection to the redirector is closed, you cannot send or receive the request data and the response data.

When the response data of static contents is sent to the client

--

--

Legend:

--: Not applicable

(2) When a response is received by the redirector

When a request is sent to the Web container, the redirector awaits for a response from the Web container. You can set the timeout for this response waiting time. You can detect the occurrence of failure in the Web container using the communication timeout that was set up. You can detect the following failures:

Detectable failures
  • The host on which the Web container is running is down.

  • A network failure occurs between the Web container and the redirector.

  • A Web application failure occurs in the Web container.

The following failures occur in the Web application:

Web application failures
  • A response is not returned due to an infinite loop in the servlets or JSPs processing.

  • The Enterprise Bean and database are invoked as an extension of servlets or JSPs, and response from them is awaited.

  • Dead lock occurs in the Web application.

  • The Web application does not catch up with the server processing and is running slow during the peak access.

Operation after communication timeout in the redirector

When communication timeout occurs, the redirector disconnects the connection to the Web container, and returns error with status code 500 to the client.

Tip

Operation when timeout occurs during processing of an application

Even if the redirector times out during processing in the Web container, you cannot detect that the redirector has timed out, in the Web container.

You can detect the timeout in the redirector once the processing of the Web container finishes, and a response is transferred to the redirector. In such a case, however, since the redirector has already disconnected the connection to the Web container, an error occurs when sending a response. The following figure illustrates the operation when a timeout occurs during processing of an application.

Figure 5‒20: peration when a timeout occurs during processing of an application

[Figure]

The figure is explained below.

  1. When a timeout occurs in the redirector, a request is sent for disconnecting the connection to the Web container.

  2. Redirector sends an error code to the Web server.

  3. When processing of the application in the Web container finishes, a response is sent to the redirector. However, since the connection between the redirector and the Web container is already disconnected in 1, a communication error occurs.

(3) When a response is sent by the Web server

You can set a timeout period in the Web server, for sending data to the client. You can detect the occurrence of failure in the client by using the communication timeout that was set up. You can detect the following failures:

Detectable failures
  • The host on which the client is running is down.

  • A network failure occurs between the client and the Web server.

  • A failure occurs in client application.