敬的世界

          常用鏈接

          統計

          最新評論

          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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 内黄县| 康马县| 沅陵县| 华坪县| 永济市| 威远县| 万源市| 绥化市| 安泽县| 施秉县| 睢宁县| 吉安县| 子洲县| 顺义区| 阜平县| 沈阳市| 嘉荫县| 奉贤区| 南皮县| 辰溪县| 弋阳县| 澄迈县| 双柏县| 兴宁市| 夏津县| 绥滨县| 云和县| 安康市| 慈利县| 含山县| 湟源县| 富锦市| 遵化市| 平塘县| 五寨县| 分宜县| 和平县| 通海县| 安塞县| 法库县| 黄山市|