EJB Rookie Primer Sanbang

Source: Internet
Author: User


A axe:
What is the difference between a buffer pool and activation, passivation?
A: No contact at all, buffer pool is stateless session bean and entity bean

To reduce the use of memory, use the instance pool in memory when the client uses the home interface
When an object is generated, an instance is assigned to it, and after the object is destroyed, the instance is returned to the
Instance pool. Did you think the buffer pool was built on the hard drive? Think about the virtual memory
Speed, not so slow. :) and activation passivation is a stateful session bean in order to save
Its state, write its state to level two storage, which is the hard drive.
Second axe:
How does EJB call between?
A: The same as the client call. First use the home interface to find or create, and then use the remote interface
and EJB objects to access each other. No way. The same machine with RMI? No way, look.
EJB Definition: EJB architecture is the development and configuration of component-based distributed business applications
A component structure. Applications developed with an EJB structure are scalable, transactional, multiple
User-safe. These applications may need to be written only once, but they can be used to support EJB rules
The Task server platform is configured on a fan. So that's why EJB is suitable for high-end applications,
But the new local interface changed this:
Sanbang:
What is narrow?
Narrow is a rmi/iiop in order to be compatible with CORBA. Because CORBA in order to
Compatible with languages such as COBOL, and does not support absolute coercion of type conversions. and RMI
There are some methods that must convert a remote reference from a more generic type to a more specific type.
CORBA provides a method that explicitly restricts references to special types. Javax.rmi.portable
The Remoteobject.narrow () method abstracts this method. EJB home or EJB object only
Remote references are not returned with a special remote interface type, you need to use the narrow method.
This occurs in six different situations:


1. Use the Javax.naming.context.lookup () method to obtain the EJB home interface.
Object Ref=jndicontext.lookup ("Cabinhome");
Cabinhome home= (cabinhome) Portableremoteobject.narrow (ref
, Cabinhome.class);


2. Use the Javax.ejb.handle.getejbobject () method to obtain an EJB object reference.
Handle Handle=....//get Handle
Object Ref=handle.getejbobject ();
Cabinhome home= (cabinhome) Portableremoteobject.narrow (ref
, Cabinhome.class);


3. Use the Javax.ejb.homehandle.getejbhome () method to get the EJB home reference.
Homehandle Homehdle=....//get Home Handle
EJBHome Ref=homehdle.getejbhome ();
Cabinhome home= (cabinhome) Portableremoteobject.narrow (ref
, Cabinhome.class);


4. Use the Javax.ejb.ejbmetadata.getejbhome () method to get the EJB home reference.
Ejbmetadata Metadata=homehdle.getejbmetadata ();
EJBHome Ref=metadata.getejbhome ();
Cabinhome home= (cabinhome) Portableremoteobject.narrow (ref
, Cabinhome.class);


5. Obtain an EJB object reference from the return collection of a home interface lookup method.


6. Return a wide range of EJB objects from any business object.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.