uCosminexus Application Server, EJB Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.13.6 Precautions concerning invocation of the EJB remote interface

This subsection describes the precautions concerning invocation of the EJB remote interface.

Organization of this subsection
(1) Precautions when applying optimization of local invocation
(2) Precautions when setting up the operation during the occurrence of a communication failure in the EJB remote interface
(3) Precautions when executing multiple threads
(4) Precautions when the caching functionality has been enabled in the naming management functionality

(1) Precautions when applying optimization of local invocation

(2) Precautions when setting up the operation during the occurrence of a communication failure in the EJB remote interface

When NO_RECONNECT (no reconnection or resending) is selected with the ejbserver.container.rebindpolicy key of system properties and if a connection is disconnected due to the communication failure, you will not be able to reuse the corresponding object reference because a reconnection is prevented. Therefore, when a method of the Enterprise Bean is to be invoked for the next time in the EJB client, re-execute the lookup method in an EJB home object and the create method in an EJB object, and then invoke the method. If the connection is disconnected during the method invocation of an Enterprise Bean, the method will throw either of the following exceptions:

java.rmi.RemoteException
Instance when the detail field is org.omg.CORBA.REBIND

java.rmi.MarshalException
Instance when the detail field is org.omg.CORBA.COMM_FAILURE

An example of coding of the client that catches these exceptions is as follows:

try {
     //JNDI.lookup()
     //EJBHome.create()
     //EJBObject.invoke()
    } catch (java.rmi.MarshalException e) {
      if (e.detail instanceof org.omg.CORBA.COMM_FAILURE) {
        //Processing corresponding to communication failure
      }
    } catch (java.rmi.RemoteException e) {
      if (e.detail instanceof org.omg.CORBA.REBIND) {
        //Processing corresponding to communication failure
      }
    }

(3) Precautions when executing multiple threads

When you use multiple threads (from one client) to invoke an EJB method defined as a remote interface, there is only one connection to the server and multiple threads share that connection. If a timeout occurs and the connection closes with one EJB invocation, a communication failure occurs in the invocation of other EJBs. If you have selected "reconnect the connection and resend the request" as a client operation, EJB invocation will be executed again.

To prevent the closure of the connection when a timeout occurs, specify the following contents in usrconf.properties (user property file for the J2EE server, user property file for a batch server, or user property file for a Java application) at the EJB invocation source (client side). For details, see the TPBroker Operation Guide.

Contents:
vbroker.ce.iiop.ccm.htc.readerPerConnection=true
vbroker.ce.iiop.ccm.htc.threadStarter=true

When you specify the above-mentioned contents, a thread to be activated is added. For details on the estimation of the number of threads, see 5.2.1 Estimating the resources used by J2EE server in the uCosminexus Application Server System Design Guide.

(4) Precautions when the caching functionality has been enabled in the naming management functionality

When the caching functionality has been enabled in the naming management functionality, the disabled object reference on the cache will be acquired if the lookup method is executed after the connection is disconnected. In such a case, when you execute the javax.rmi.PortableRemoteObject.narrow method and the create method using the acquired object reference, a CORBA exception (such as org.omg.CORBA.OBJECT_NOT_EXIST) will occur.

Clear the disabled cache after the connection is disconnected. For details on the procedure, see 2.8.2 Clearing the cache used in naming in the uCosminexus Application Server Common Container Functionality Guide.