Java Reference
In-Depth Information
No-interface view : This session bean is a variant of the local business view that
does not require a separate interface, that is, all public methods of the bean
class are automatically exposed to the caller.
Since EJB 3.1, it is possible to use asynchronous methods. These are able to process client
requests asynchronously, just like MDBs, except that they expose a typed interface and
follow a more complex approach to process client requests. It is possible to use two ap-
proaches to achieve this kind of behavior:
• Fire-and-forget asynchronous void methods, which are invoked by the client
• Retrieve-result-later asynchronous methods, which have the Future<?> return
type
What more should you know about EJBs before proceeding? When you develop an Enter-
prise JavaBean, you have to follow some general rules, which are as follows:
• Avoid using nonfinal static fields
• Don't manually create threads (we will cover this topic more deeply in Chapter
12 , Long-term Tasks' Execution )
• Don't use synchronization primitives (except in singletons with bean-managed
concurrency)
• Manual file operations on the filesystem and listening on sockets are forbidden
• Native libraries should not be loaded
Disobeying these rules could cause security and stability issues with the EJB container. A
comprehensive list of disallowed activities can be found at http://www.oracle.com/tech-
network/java/restrictions-142267.html along with some explanations for specific points.
Since it's easier to grasp the concepts with real examples, in the next section, we will
provide a concrete application example that introduces some of the features that we de-
scribed in this section.
Search WWH ::




Custom Search