3

This tutorial says that Message Driven Bean class cannot be defined as abstract or final. What is the reason for this? Why this class cannot be closed for extensions?

UPDATE: I test this on JBoss Eap 6.3, And what I noted is MDB doesn't get fired though there are messages in the queue, But I couldn't find any error logs regarding this.

Isuru Gunawardana
  • 2,847
  • 6
  • 28
  • 60
  • 1
    This is a good question. The EJB 3.1 spec doesn't say anything more than the tutorial. – Magnilex Feb 11 '15 at 08:12
  • I tried doing this, And what I noted is MDB doesn't get fired though there are messages in the queue, But I couldn't find any error logs regarding this. I tried this on JBoss Eap 6.3 – Isuru Gunawardana Feb 12 '15 at 10:11

1 Answers1

1

To let containers instrument the instancess - which allows them to inject dependencies and do other tricks. Good article on instrumentation - http://javapapers.com/core-java/java-instrumentation/. Containers may do it in many different ways of course.

user656449
  • 2,950
  • 2
  • 30
  • 43
  • Its not clear enough for me to accept this as the answer. How inject dependencies affect class being final? – Isuru Gunawardana Mar 06 '15 at 04:52
  • 1
    in most cases it's impossible to insturment final class. Look, for example at this http://stackoverflow.com/questions/16437323/how-can-i-create-dynamic-proxy-for-final-class, it's about http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/, the library used by hibernate to do instrumentation. Although I never cared too much about such a deep details, so you may want to find more reliable sources :) – user656449 Mar 10 '15 at 07:30