2.2. JBoss Cache 設定

2.2. JBoss Cache 設定

JBoss Cache は、 JBoss クラスタに分散キャッシュとステート複製サービスを提供します。 JBoss クラスタは複数の JBoss Cache MBean (TreeCache MBean として知られている) を持つことができ、一つは HTTP セッション複製のために、もうひとつはステートフルセッション Bean のために、またもうひとつはキャッシュされたエンティティ Bean などのためにあります。一般的な TreeCache MBean 設定は以下にリストしてあります。アプリケーション特定の TreeCache MBean 設定は、これらのアプリケーションが論じられるときに後の章で触れます。

<mbean code="org.jboss.cache.TreeCache" 
        name="jboss.cache:service=TreeCache">
    
    <depends>jboss:service=Naming</depends> 
    <depends>jboss:service=TransactionManager</depends> 

    <! -- Configure the TransactionManager --> 
    <attribute name="TransactionManagerLookupClass">
        org.jboss.cache.DummyTransactionManagerLookup
    </attribute> 

    <! -- 
            Node locking level : SERIALIZABLE
                                 REPEATABLE_READ (default)
                                 READ_COMMITTED
                                 READ_UNCOMMITTED
                                 NONE        
    --> 
    <attribute name="IsolationLevel">REPEATABLE_READ</attribute> 

    <! --     Valid modes are LOCAL
                             REPL_ASYNC
                             REPL_SYNC
    --> 
    <attribute name="CacheMode">LOCAL</attribute>
 
    <! -- Name of cluster. Needs to be the same for all clusters, in order
             to find each other --> 
    <attribute name="ClusterName">TreeCache-Cluster</attribute> 

    <! --    The max amount of time (in milliseconds) we wait until the
            initial state (ie. the contents of the cache) are 
            retrieved from existing members in a clustered environment
    --> 
    <attribute name="InitialStateRetrievalTimeout">5000</attribute> 

    <! --    Number of milliseconds to wait until all responses for a
            synchronous call have been received.
    --> 
    <attribute name="SyncReplTimeout">10000</attribute> 

    <! --  Max number of milliseconds to wait for a lock acquisition --> 
    <attribute name="LockAcquisitionTimeout">15000</attribute> 

    <! --  Name of the eviction policy class. --> 
    <attribute name="EvictionPolicyClass">
        org.jboss.cache.eviction.LRUPolicy
    </attribute> 

    <! --  Specific eviction policy configurations. This is LRU --> 
    <attribute name="EvictionPolicyConfig">
        <config>
            <attribute name="wakeUpIntervalSeconds">5</attribute> 
            <!--  Cache wide default --> 
            <region name="/_default_">
                <attribute name="maxNodes">5000</attribute> 
                <attribute name="timeToLiveSeconds">1000</attribute> 
            </region>

            <region name="/org/jboss/data">
                <attribute name="maxNodes">5000</attribute> 
                <attribute name="timeToLiveSeconds">1000</attribute> 
            </region>

            <region name="/org/jboss/test/data">
                <attribute name="maxNodes">5</attribute> 
                <attribute name="timeToLiveSeconds">4</attribute> 
            </region>
        </config>
    </attribute>

    <attribute name="CacheLoaderClass">
        org.jboss.cache.loader.bdbje.BdbjeCacheLoader
    </attribute>
    
    <attribute name="CacheLoaderConfig">
       location=c:\\tmp
    </attribute>
    <attribute name="CacheLoaderShared">true</attribute>
    <attribute name="CacheLoaderPreload">
        /a/b/c,/all/my/objects
    </attribute>
    <attribute name="CacheLoaderFetchTransientState">false</attribute>
    <attribute name="CacheLoaderFetchPersistentState">true</attribute>
    
    <attribute name="ClusterConfig">
        ... JGroups config for the cluster ...
    </attribute>
</mbean>
        

JGroup 設定要素 (すなわち, the ClusterConfig 属性) は上記のリストから省略されています。 JGroup の設定方法を,この章の (項2.1. 「JGroup 設定」) はじめで学びました。 TreeCache MBean は以下の属性を取得します。