敬的世界

          常用鏈接

          統計

          最新評論

          Read-Mostly Pattern

          For persistent data that is ony occasionaly updated, you can implement a "read-mostly pattern" in WebLogic Server by mapping a read-only and a read-write entity bean to the same data. You use the read-only entity bean for reads and the read-write entity bean for writes.

          The read-only entity EJB loads bean data at intervals specified by the read-timeout-seconds element in the entity-catch(or entity-cache-ref) stanza for the bean in weblogic-ejb-jar.xml. To ensure that the read-only bean always returns current data, the read-only bean must be invalidated when the read-write bean changes the entity bean data. You can configure WebLogic Server to automatically invalidate the read-only bean, or explicitly invaidate it in bean code, as described in Invalidating Read-Only Entity EJBs  Implicitly and Invalidating Read-Only Entity EJBs Explicitly respectively.

          In a WebLogic Server cluster, the read-mostly pattern gives clients of the read-only EJB the performance advantage of reading from cache, while clients of read-write EJB enjoy true transactional behavior---the read-write EJB's cached state always matches theh persistent data in the database.

          Invalidating Read-Only Entity EJBs Implicity 

          The invalidation-target element in the entity-descriptor stanza in weblogic-ejb-jar.xml identifies a read-only entity EJB that should be invalidated when a CMP entity bean has been modified.

          invalidation-target may only be specified for an EJB 2.0 CMP entity bean. The target ejb-name must be a read-only entity EJB.

          Invalidating Read-Only Entity EJBs Explicitly

          Invalidate a read-only entity bean by calling the following invalidate() method on either the CachingHome or CachingLocalHome interface.

          Listing 6-10 CachingHome and CachingLocalHome interfaces

            
          package weblogic.ejb;
          public interface CachingHome {
          public void invalidate(Object pk) throws RemoteException;
          public void invalidate (Collection pks) throws RemoteException;
          public void invalidateAll() throws RemoteException;
          public interface CachingLocalHome {
          public void invalidate(Object pk) throws RemoteException;
          public void invalidate (Collection pks) throws RemoteException;
          public void invalidateAll() throws RemoteException
          }

          posted on 2008-10-02 17:02 picture talk 閱讀(157) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 铜山县| 柞水县| 通河县| 淮北市| 汉沽区| 克拉玛依市| 株洲市| 桃江县| 盐边县| 海林市| 三门县| 西乌珠穆沁旗| 通渭县| 磴口县| 兴安盟| 满城县| 秀山| 台北市| 区。| 绥江县| 泰和县| 尼勒克县| 大名县| 棋牌| 福泉市| 滨州市| 巴彦县| 龙里县| 怀仁县| 吉隆县| 怀远县| 临高县| 海阳市| 桑植县| 米脂县| 奉节县| 台湾省| 太谷县| 辽阳市| 额尔古纳市| 登封市|