• <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

            文章均收錄自他人博客,但不喜標題前加-[轉貼],因其丑陋,見諒!~
            隨筆 - 1469, 文章 - 0, 評論 - 661, 引用 - 0
            數據加載中……

            無狀態類,有狀態類

             

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

             

            在server端,不維護每個client的狀態,將會減少麻煩,是否需要引入無狀態思路呢?那么每個交互都是request<-->response模式

             

            有狀態模式,就是session維護模式,這還是非常常見的。

             

            參考

             

            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實例并非使用時創建,而是實現創建一個對象池,當client需要該bean中方法時,如果時無狀態的,容器會隨便指定一個空閑的給client使用,但是如果是有狀態的,容器必須記住上次是那個bean實例為這個client服務的,下次同一個client請求也必須由這個同一個實例來服務,不能換由其他的bean實例來服務

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

            狠狠色丁香久久婷婷综合| 四虎国产精品成人免费久久| 久久久久亚洲AV成人网人人网站 | 精品无码久久久久久午夜| 亚洲国产精品无码久久久不卡| 久久久无码精品亚洲日韩蜜臀浪潮 | 国产精品日韩深夜福利久久 | 午夜不卡久久精品无码免费| 波多野结衣中文字幕久久| 久久一区二区免费播放| 日日躁夜夜躁狠狠久久AV| 蜜桃麻豆www久久| 亚洲va中文字幕无码久久不卡| 久久国产成人精品麻豆| 国产毛片欧美毛片久久久| 精品久久久久久久中文字幕| 国产69精品久久久久久人妻精品| 日本精品久久久中文字幕| 亚洲AV无一区二区三区久久| 国产精品无码久久四虎| 99久久超碰中文字幕伊人| 久久无码专区国产精品发布| 国产激情久久久久影院| 色诱久久久久综合网ywww| 青春久久| 人妻无码久久精品| 亚洲午夜精品久久久久久人妖| 日韩精品久久久肉伦网站| 漂亮人妻被中出中文字幕久久| 久久精品无码一区二区日韩AV | 久久天天躁狠狠躁夜夜avapp| 色诱久久av| 一本综合久久国产二区| 91性高湖久久久久| 国产成人精品久久亚洲高清不卡| 久久精品国产亚洲AV无码偷窥| 国产精品美女久久福利网站| 女人高潮久久久叫人喷水| 久久综合狠狠综合久久97色| 国内精品久久久久久久影视麻豆| 九九99精品久久久久久|