setRequestTimeout method (format 1)

Description

Sets an RMI-IIOP communication timeout. This method generates a copy of the obj parameter and returns an object in which the sec parameter is set as the timeout value. The timeout set by this method is valid for the returned object.

Format

public java.rmi.Remote setRequestTimeout(java.rmi.Remote obj,
                                        int sec)
 throws IllegalArgumentException,
        IllegalStateException;

Parameters

obj:
Specify the object (EJBHome or EJBObject) for which the timeout is set.
sec:
Specify an integer in the range of 0 to 86400 for the timeout period (unit: seconds). The timeout is not set when 0 is specified.

Exceptions

java.lang.IllegalArgumentException:
This exception is thrown when an invalid object is specified as the target for setting timeout or an invalid value is specified for timeout period.
java.lang.IllegalStateException:
An attempt to set the timeout failed.

Return value

This method returns the object that is set with a timeout value.

Caution

When you set a timeout with this method, it takes more time for processing as compared to the time taken to set the timeout by using the setRequestTimeout method (format 2).