aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes What does really occur after a system exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "What does really occur after a system exception?" Watch "What does really occur after a system exception?" New topic
Author

What does really occur after a system exception?

Oliver Rensen
Ranch Hand

Joined: Jul 23, 2004
Posts: 109

Hello ranchers,

the spec contains on the pages 375 and 376 the following informations what happens after throwing a system exceptions:

- Log the exception.
- Mark the transaction for rollback.
- Discard instance. Discard instance means that the Container must not invoke any business methods or container callbacks on the instance.

Today, I have worked with a session bean mock-exam from ejb-certificate, and there was the following question:

Given that a stateful session bean implements the SessionSynchronization interface, select the correct order in which a container calls a transactional business method that throws a system exception.

The correct answer was:
afterBegin(), business method, afterCompletion()
If a business method raises a system exception whilst in the context of transaction, afterCompletion() is called on the session bean instance with a boolean value of false to notify the instance that a rollback has occurred.


The spec wrotes, that after a system exception the instance will be discarded, and that the Container must not invoke any business methods or container callbacks on the instance. But afterCompletion() is a container-callback-method, isn't it?

Why does the Container calls afterCompletion() after a system exception? I have thought that the container will invoke NO method on the bean-instance after a system exception has occurred.

Regards,
Oliver
chao cai
Ranch Hand

Joined: May 26, 2005
Posts: 154
I think the AfterComplete will be invoke when the stateful bean invoke other bean's method, and that method throw a system Exception. container will discard other bean not your stateful bean


SCEA<br />SCJP 1.2<br />SCBCD<br />MCSD<br />IBM Certified Specialist RUP v2003<br />IBM Certified Solution Designer OOAD vUML2<br /> <br />Phone Number:86-010-82776427
 
Don't get me started about those stupid light bulbs.
 
subject: What does really occur after a system exception?