• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            woaidongmao

            文章均收錄自他人博客,但不喜標(biāo)題前加-[轉(zhuǎn)貼],因其丑陋,見諒!~
            隨筆 - 1469, 文章 - 0, 評(píng)論 - 661, 引用 - 0
            數(shù)據(jù)加載中……

            無(wú)狀態(tài)類,有狀態(tài)類

             

            stated class, stateless class, 兩種類別,代表了一種思路

             

            在server端,不維護(hù)每個(gè)client的狀態(tài),將會(huì)減少麻煩,是否需要引入無(wú)狀態(tài)思路呢?那么每個(gè)交互都是request<-->response模式

             

            有狀態(tài)模式,就是session維護(hù)模式,這還是非常常見的。

             

            參考

             

            Stateless or Stateful?


            Service objects will usually be stateless. Stateless service layers are highly scalable: They pose no replication
            issues and there is no need to allocate additional resources for every client. (Remember that one of
            the key motivations of a middle tier is to share resources between multiple clients.) It is also much easier
            for stateless service layers to support remote clients, if necessary.


            The traditional stateless service objects in J2EE applications are stateless session beans (SLSBs). I’ll use
            SLSBs as a starting point for discussion because they illustrate many of the basic concepts of stateless
            service objects, which predate EJB.


            A stateless service layer is one concession of object orientation that I find not too painful. Stateless service
            objects are semi-objects. Although they cannot expose state to callers, they can hold internal state
            and they can fully participate in inheritance relationships. If they are local, rather than remote, they can
            use true objects as parameters and return values.


            There are two main potential models for stateful service layers in J2EE: stateful session beans (SFSBs) and
            web tier session objects. If we don’t use stateful session beans, session data is usually held in Servlet API
            HttpSession objects. Holding session data in the web tier is usually more scalable than holding it in the
            EJB tier. (See Chapter 10 of Expert One-on-One J2EE Design and Development for detailed discussion of
            state replication issues.) “Thick” clients such as Swing applications will normally hold their own state.
            Because stateless service layers have proven their value in numerous technologies, including both J2EE
            and Microsoft platforms, we’ll focus on them in this book.

            If possible, design applications to use a stateless service layer. Hold state in the web
            tier, rather than in the business logic tier, if possible.

             

            對(duì)于EJB來(lái)講,Bean實(shí)例并非使用時(shí)創(chuàng)建,而是實(shí)現(xiàn)創(chuàng)建一個(gè)對(duì)象池,當(dāng)client需要該bean中方法時(shí),如果時(shí)無(wú)狀態(tài)的,容器會(huì)隨便指定一個(gè)空閑的給client使用,但是如果是有狀態(tài)的,容器必須記住上次是那個(gè)bean實(shí)例為這個(gè)client服務(wù)的,下次同一個(gè)client請(qǐng)求也必須由這個(gè)同一個(gè)實(shí)例來(lái)服務(wù),不能換由其他的bean實(shí)例來(lái)服務(wù)

            posted on 2011-07-06 20:42 肥仔 閱讀(772) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 編程思想

            国产一区二区精品久久 | 亚洲午夜福利精品久久| 国内精品久久久久久久亚洲| 老司机午夜网站国内精品久久久久久久久 | 99精品国产99久久久久久97| 国产成人精品白浆久久69| 久久精品国产欧美日韩| 亚洲AV无码久久| 久久久亚洲精品蜜桃臀| 2020久久精品国产免费| 久久久久久久91精品免费观看| 久久精品国产福利国产秒| 亚洲精品乱码久久久久久按摩| 精品国产乱码久久久久久浪潮| 国产69精品久久久久久人妻精品 | 怡红院日本一道日本久久 | 无码人妻精品一区二区三区久久| 欧美亚洲另类久久综合| 亚洲AV无码久久精品色欲 | 99热都是精品久久久久久| 亚洲国产精品久久久天堂 | 久久综合综合久久97色| 久久精品毛片免费观看| 无码人妻久久一区二区三区蜜桃| 色天使久久综合网天天| 99精品伊人久久久大香线蕉| 精品无码久久久久国产| 久久久久久国产精品美女| 亚洲国产成人精品女人久久久| 91精品日韩人妻无码久久不卡| 99久久99久久| 69久久精品无码一区二区| 久久久久亚洲av无码专区导航| 久久国产欧美日韩精品| 国产精品久久新婚兰兰| 亚洲精品美女久久久久99小说 | 狠狠综合久久综合中文88| 国产ww久久久久久久久久| 精品国产91久久久久久久a| 亚洲国产精品久久久久婷婷软件| 久久777国产线看观看精品|