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

Sun Microsystems Inc

STATEFUL Session Bean State Diagram

Enterprise JavaBeans 2.0, Public Draft

Session Bean Component Contract

Additional restrictions:

The getRollbackOnly and setRollbackOnly methods of the SessionContext interface should be used only in the session bean methods that execute in the context of a transaction. The Container must throw the java.lang.IllegalStateException if the methods are invoked while the instance is not associated with a transaction.

The reasons for disallowing the operations in Table 2 follow:

Invoking the getEJBObject methods is disallowed in the session bean methods in which there is no session object identity established for the instance.

Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in the session bean methods for which the Container does not have a client security context.

Invoking the getRollbackOnly and setRollbackOnly methods is disallowed in the session bean methods for which the Container does not have a meaningful transaction context, and to all session beans with bean-managed transaction demarcation.

Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context.

The UserTransaction interface is unavailable to enterprise beans with container-managed transaction demarcation.

6.6.2 Dealing with exceptions

A RuntimeException thrown from any method of the session bean class (including the business methods and the callbacks invoked by the Container) results in the transition to the “does not exist” state. Exception handling is described in detail in Chapter 17.

From the client perspective, the corresponding session object does not exist any more. Subsequent invocations through the remote interface will result in java.rmi.NoSuchObjectException.

6.6.3 Missed ejbRemove() calls

The Bean Provider cannot assume that the Container will always invoke the ejbRemove() method on a session bean instance. The following scenarios result in ejbRemove() not being called on an instance:

A crash of the EJB Container.

A system exception thrown from the instance’s method to the Container.

A timeout of client inactivity while the instance is in the passive state. The timeout is specified by the Deployer in an EJB Container implementation specific way.

69

5/31/00