46 Chapter 2 As you can see, we (Email web hosting)
46 Chapter 2 As you can see, we avoid the steps of the stub, skeleton, network, and marshaling/ demarshaling of parameters. This empowers us to write smaller beans that perform more fine-grained tasks, without fear of a performance hit at each and every cross-bean method call. You can create beans in a fast way as well. Rather than using the home interface and home object, you can call a special local home interface, which is implemented by the container as the local home object. These local interfaces are entirely optional; you can use them as a replacement or as a complement to the remote interfaces. For simplicity, in the remainder of this book, we will use the word EJB object to mean the request interceptor, the remote interface to mean the interface to the request interceptor, the home object to mean the factory, and the home interface to mean the factory interface. Unless it s pointed out explicitly, all information that applies to these remote interfaces and remote objects also apply to their local counterparts. Also note that the EJB specification has defined the term component interface to mean either the remote interface or local interface. We will occasionally use this term in this book. EJB OBJECTS AND BEAN INSTANCES One question we frequently are asked in our EJB training courses is How many home objects are there for each bean? The answer to this question is vendor- specific. Most containers will have a 1:N relationship between home objects and bean instances. This means that all clients use the same home object instance to create EJB objects. The home object will probably be written to be thread-safe so that it can service many client requests concurrently. It is perfectly fine for the container to do this because the container itself is multithreaded (only your beans are single-threaded). Another question we typically get is How many EJB object instances are there for each bean instance? Some containers can have a 1:N relationship, where each EJB object is multithreaded (just like home objects). Other containers might have an M:N relationship, where M represents the number of EJB objects instantiated (and corresponds exactly to the number of clients currently connected), and N represents the number of bean instances in the pool. In this case, each EJB object is single-threaded. None of this really matters to you as a bean provider because you should think of the container as a black box. However, it s sometimes fun to know what s going on behind the scenes in case low-level debugging is required.
Pay us little and get a lot! We will give you the cheapest web hosting available, trust us and check cheapest web hosting services.