• <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, 評論 - 661, 引用 - 0
            數(shù)據(jù)加載中……

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

             

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

             

            在server端,不維護(hù)每個client的狀態(tài),將會減少麻煩,是否需要引入無狀態(tài)思路呢?那么每個交互都是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.

             

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

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

            www.久久热| 久久青青草原精品国产软件| 亚洲αv久久久噜噜噜噜噜| 中文字幕久久久久人妻| 国产精品美女久久久久久2018| 情人伊人久久综合亚洲| 亚洲&#228;v永久无码精品天堂久久 | 一本色道久久99一综合| 7777精品久久久大香线蕉| 99久久精品国内| 欧美精品国产综合久久| 狠狠狠色丁香婷婷综合久久五月 | 亚洲精品高清国产一久久| 热久久国产欧美一区二区精品| 亚洲精品美女久久777777| 久久久久久亚洲精品不卡| 亚洲精品乱码久久久久久自慰| 久久亚洲国产成人精品无码区| 97精品久久天干天天天按摩| 久久精品国产亚洲AV香蕉| 久久精品免费大片国产大片| 国产成人久久精品区一区二区| 精品久久久无码21p发布| 久久精品国产一区二区电影| 狠狠色婷婷综合天天久久丁香| 亚洲国产精品无码久久一线| 久久亚洲精品无码播放| 97超级碰碰碰碰久久久久| 亚洲∧v久久久无码精品| 久久亚洲精品国产精品婷婷| 久久精品国产亚洲精品| 久久er国产精品免费观看8| 久久久久国产一级毛片高清版| 久久九九精品99国产精品| 亚洲精品无码久久久久去q | 99久久综合国产精品二区| 久久免费线看线看| 中文字幕亚洲综合久久| 国产成人AV综合久久| 国产精品青草久久久久福利99| 色综合合久久天天综合绕视看|