3.10. EJB rules, standards and limitations

The EJB Specification sets out many rules about how an EJB’s implementation class and its interfaces should be coded. These can be divided into the following general groups.

Common sense For example, methods on a remote interface should be public (nothing would work properly otherwise), and EJBs should not attempt to use graphics operations to produce output (who would see it?).

Not obvious, but clearly necessary when understood For example, an EJB should not use writable static instance variables. This is because the EJB server may pool instances of the EJB’s classes in different JVMs. It would be awkward to keep the static instance variables synchronized between different JVMs.

Required to help ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.