Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc.

Exception handling

Enterprise JavaBeans 2.0, Public Draft

Client’s view of exceptions

17.3.7 Release of resources

When the Container discards an instance because of a system exception, the Container should release all the resources held by the instance that were acquired through the resource factories declared in the enterprise bean environment (See Subsection 19.4).

Note: While the Container should release the connections to the resource managers that the instance acquired through the resource factories declared in the enterprise bean environment, the Container cannot, in general, release “unmanaged” resources that the instance may have acquired through the JDK APIs. For example, if the instance has opened a TCP/IP connection, most Container implementations will not be able to release the connection. The connection will be eventually released by the JVM garbage collector mechanism.

17.3.8 Support for deprecated use of java.rmi.RemoteException

The EJB 1.0 specification allowed the business methods, ejbCreate, ejbPostCreate, ejbFind<METHOD>, ejbRemove, and the container-invoked callbacks (i.e. the methods defined in the EntityBean, SessionBean, and SessionSynchronization interfaces) implemented in the enterprise bean class to use the java.rmi.RemoteException to report non-application exceptions to the Container.

This use of the java.rmi.RemoteException was deprecated in EJB 1.1—enterprise beans written for the EJB 2.0 or EJB 1.1 specification should use the javax.ejb.EJBException instead.

The EJB 2.0 and EJB 1.1 specification require that a Container support the deprecated use of the java.rmi.RemoteException. The Container should treat the java.rmi.RemoteException thrown by an enterprise bean method in the same way as it is specified for the javax.ejb.EJBException.

Note: The use of the java.rmi.RemoteException is deprecated only in the above-mentioned methods. The methods of the remote and home interface still must use the java.rmi.RemoteException as required by the EJB specification.

17.4 Client’s view of exceptions

This section describes the client’s view of exceptions received from an enterprise bean invocation.

A client accesses an enterprise Bean through the enterprise Bean’s remote and home interfaces. Both of these interfaces are Java RMI interfaces, and therefore the throws clauses of all their methods (including those inherited from superinterfaces) include the mandatory java.rmi.RemoteException.The throws clauses may include an arbitrary number of application exceptions.

5/31/00

350