12 the most important J2EE optimal practice (2)
6. When use EJB component, use conversational Facades from beginning to end.
Want to expose hypostatic Bean any user types directly anything but. Can use interface of this locality EJB only to hypostatic Bean (Local EJB Interfaces) .
When use EJB component, using a conversational Facades is one affirms undoubted optimal practice. Actually, this current practice is applied in any distributed technologies widely, include CORBA, EJB and DCOM. From go up at all tell, the more ground floor changes " of your area of distributinging " across that uses a program, the data to small because for many times the time that reduplicative network relay creates is used up less. Wanting the method that achieves this goal is: Establish the Facades target of large size, this object includes logistic subsystem, can call through a method consequently can fulfil a few useful business functions. This kind of method not only can reduce network expense, and it is OK also that environment of a work is founded through be whole business function in EJB interior the visit number that reduces pair of databases greatly.
Interface of EJB this locality (begin to use from EJB 2.0 standard) offerred function to optimize a method for concomitant EJB. This locality interface must be made explicitly visit by your applied process, the when EJB is being configured after change and preventing need of this need code applies the change of the program. The whole EJB that includes as a result of conversational Facades and it to each other should be this locality, we suggest to the substance at the back of conversational Facades Bean uses this locality interface. However, the implementation of conversational Facades itself (if typical case does not have condition conversation Bean) should design for long-range interface.
For function optimize, can add interface of a this locality conversational Facades. Such doing used a such facts: Fall in most circumstance (it is at least in Web application process) , your EJB client end and EJB will be collective consist in is same a Java fictitious machine (JVM) in. Additionally one kind of circumstance, if conversational Facades is called in this locality, can use configuration of J2EE application server to optimize (Configuration Optimizations) , for example the "No Local Copies" in WebSphere. However, the plan that you must notice to these can offer an alternative is met will alternate means from deliver by the value (Pass-by-value) the change cites to press deliver (Pass-by-reference) . This may produce very delicate mistake in your code. When you should use these program, you are considering its feasibility at the beginning.
If long-range interface is used in your conversational Facades (is not this locality interface) , you also can be same conversational Facades in J2EE 1.4 be configured with compatible means as Web service. Because,this is JSR 109 (the Web in J2EE 1.4 serves deploy part) the interface that the requirement uses the long-range interface that does not have condition conversation Bean to regard EJB Web as service and EJB implementation. Such doing is worthiness, the business logic that because such doing,can be you increases a client to carry the amount of the type.
Previous12 3 4 5 6 7 Next
Hot Tags: