欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

EJB3 in action 學習筆記之一

系統 1792 0
? EJB3 in action 學習筆記之一
?
1.Three primary techniques in EJB 3 eliminate these sources of complexity: metadata annotations, minimal deployment descriptors, and dependency injection .
?
2.The primary goal of dependency injection (DI) is to make component
interdependencies as loosely coupled as possible.
3. Unlike stateless session beans, stateful session beans guarantee that a client can expect to set the internal state of a bean and count on the state being maintained between any number of method calls.
4. The @Remove annotation marks the end of the workflow modeled by a stateful bean. In our case, we are telling the container that there is no
longer a need to maintain the bean’s session with the client after the
confirmOrder method is invoked.
5. If your application needs robust support for accessing remote components or the ability to seamlessly expose your business logic as web services , EJB 3 is the clear choice.
?
The anatomy of a session bean
6. Each session bean implementation has two distinct parts— one or more bean interfaces and a bean implementation class.
?
7. The following summarizes the rules that apply to all types of session beans:
■ As we discussed earlier in section 3.1.2, a session bean must have at least one business interface.( session bean 至少有一個業務接口。 )
■ The session bean class must be concrete. You cannot define a session bean class as either final or abstract since the container needs to manipulate it. ( session bean 類必須是具體的類,不能將其定義為 final abstract 類型,因為容器需要處理該類。 )
■ You must have a no-argument constructor in the bean class. As we saw, this is because the container invokes this constructor to create a bean instance when a client invokes an EJB. Note that the compiler inserts a default no argument constructor if there is no constructor in a Java class.( session bean 類中必須定義一個無參數的構造函數。 )
■ A session bean class can subclass another session bean or any other POJO.( session bean 能繼承其它 session bean POJO )
■ The business methods and lifecycle callback methods may be defined
either in the bean class or in a superclass. It’s worth mentioning here that
annotation inheritance is supported with several limitations with EJB 3 session beans. ( 業務方法和生命周期回調方法既可被定義在本類中,又可被定義在其超類中。 )
■ Business method names must not start with “ejb.” For example, avoid a
method name like ejbCreate or ejbAddBid because it may interfere with
EJB infrastructure processing. You must define all business methods as
public, but not final or static. If you are exposing a method in a remote
business interface of the EJB, then make sure that the arguments and the
return type of the method implement the java.io.Serializable interface.
( session bean 類中的業務方法名不能以“ ejb ”字符開頭。 )
?

8. As noted earlier, stateless session beans model tasks don’t maintain conversational state . This means that session beans model tasks can be completed in a single method call, such as placing a bid. However, this does not mean that all stateless session beans contain a single method.<o:p></o:p>

9. Three types of business interfaces correspond to the different access types:<o:p></o:p>

Local interface<o:p></o:p>

A local interface is designed for clients of stateless session beans collocated in the same container (JVM) instance.<o:p></o:p>

Remote interface<o:p></o:p>

Clients residing outside the EJB container’s JVM instance must use some kind of remote interface. Remote business interfaces do have one special requirement: all parameters and return types of interface methods must be Serializable. This is because only Serializable objects can be sent across the network using RMI.<o:p></o:p>

<o:p>?</o:p>

Web service endpoint interface<o:p></o:p>

The third type of interface is specific to stateless session beans that you haven’t seen yet: the web service endpoint interface (also known as SEI). The ability to expose a stateless session bean as a SOAP-based web service is one of the most powerful features of EJB 3.<o:p></o:p>

10. Stateful session beans are guaranteed to maintain conversational state.<o:p></o:p>

11. Since stateful session beans cannot be pooled and reused like stateless<o:p></o:p>

beans, there is a real danger of accumulating too many of them if we don’t have a way to destroy them. Therefore, we have to define a business method for removing the bean instance by the client using the @Remove annotation.<o:p></o:p>

( 由于有狀態 session bean 不能像無狀態 session bean 放入對象池而重復使用 , 所以如果我們不能及時銷毀,就會累積許多的風險。我們必須使用 @Remove 標注來定義一個業務方法去移去 bean 實例。 )<o:p></o:p>

12.A stateful session bean cannot have a web service endpoint interface.<o:p></o:p>

This is because SOAP-based web services are inherently stateless in nature.( 有狀態 session bean 不能實現 web 服務 endpoint 接口,這是由于基于 SOAP web 服務本質上是無狀態的。 )<o:p></o:p>

13<o:p></o:p>

<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape id="_x0000_i1025" style="WIDTH: 414.75pt; HEIGHT: 243pt" type="#_x0000_t75"><v:imagedata o:title="" src="file:///C:\DOCUME~1\pengch\LOCALS~1\Temp\msohtml1\01\clip_image001.emz"></v:imagedata></v:shape><o:p></o:p>

<o:p>? EJB3 in action 學習筆記之一 </o:p>

14. To outline some of the best practices for session beans: ??? <o:p></o:p>

n ?????? Choose your bean type carefully. Stateless session beans will be suitable most of the time.( 認真選擇 session 的類型,在大多時候無狀態 session bean 是最適合的。 )<o:p></o:p>

n ?????? Carefully examine interface types for session beans. Remote interfaces involve network access and may slow down your applications.( 仔細檢查 session bean 的接口類型。如果是遠程接口必須訪問網絡,這樣會減慢系統的訪問速度。 )<o:p></o:p>

n ?????? If you are using DI, make sure you don’t inject a stateful session bean into a stateless session bean or servlet.( 如果你使用依賴注入,確保不要將有狀態 session bean 注入到無狀態 session bean servlet 中。 )<o:p></o:p>

n ?????? Separate crosscutting concerns such as logging and auditing using business interceptors (which we discuss in chapter 5) instead of spreading them all over the business logic.( 使用攔截器代替在整個業務邏輯中傳遞,來分離像日志和審核等之類的橫關切點 )<o:p></o:p>

n ?????? Closely examine what kind of data you are storing in the conversation state. Try to use small, primitive instance variables in a stateful bean whenever possible as opposed to large nested composite objects.<o:p></o:p>

n ?????? Don’t forget to define remove methods in a stateful session bean.<o:p></o:p>

n ?????? Tune passivation and timeout configurations to find the optimal values for your application.( 調整純化和超時配置,以錄求系統最佳性能。 ) <o:p></o:p>



EJB3 in action 學習筆記之一


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 在线观看视频一区 | 久久cao| 欧美一区二区在线播放 | 国产精品久久久久久久久电影网 | 日本在线观看不卡 | 三级黄色片在线免费观看 | 亚洲午夜大片 | 色老头永久免费视频 | 精品久久一区二区三区 | 黄在线| 精品视频在线免费观看 | 四虎免费在线观看视频 | 黑人狂躁日本妞无码A片 | 国产99久久精品一区二区永久免费 | 亚洲天堂网在线观看 | 99精品视频在线观看re | 高清一区二区三区四区五区 | 日本精高清区一 | 欧美女人天堂 | 久草在线在线精品观看 | 亚洲欧美视频 | a级欧美片免费观看 | 婷婷影音 | 久久伊人免费视频 | 日产乱码卡1卡2卡三免费 | 免费一级在线 | 久久久激情视频 | 日本小网站 | 乱淫毛片 | 91国内外精品自在线播放 | 日本高清色惰www在线视频 | 无码人妻精品1国产婷婷 | 亚洲欧美国产一区二区三区 | 国产午夜精品一区二区三区 | 午夜在线观看免费视频 | 一区二区三区在线 | 日本精品在线播放 | 成年男女免费视频 | 亚洲在线一区二区三区 | 久久撸视频 | 国产网址在线观看 |