• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Missed PreDestroy calls

 
Promod kumar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sections 4.4.3 talks about scenarios when PreDestroy calls are missed. I tried it on Jboss 4.2.2 and @PreDestroy method was called when the instance threw a System Exception.

• 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.

Section 5.4.18 has the scenarios for MDBs. I tested it, saw that @PreDestroy was executed in this case as well. Is the container I am not using not compliant or am I missing something?

If Jboss 4.2.2 is non compliant, then would it be safe to summarize that when there is a SystemException for Session Bean or MDB, @PreDestroy method (if it exists) will not be called?
 
Devaka Cooray
Marshal
Pie
Posts: 4886
406
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the system exception you used to throw?
 
Promod kumar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used a RuntimeException as shown below.

 
Devaka Cooray
Marshal
Pie
Posts: 4886
406
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, can you check it with EJBException instead of RuntimeException.
 
Promod kumar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried it and got the same result.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic