28.2.2. -service.xml ファイルからのデプロイメント
JBoss Enterprise Application Platform 4.x と同様に、
-service.xml ファイルより JBoss Cache インスタンスを MBean サービスとしてデプロイすることもできます。JBoss 4.x と異なる点は、主に mbean 要素にある code 属性の値です。JBoss Enterprise Application Platform 4.x での値は org.jboss.cache.TreeCache でしたが、JBoss Enterprise Application Platform 5.x では org.jboss.cache.jmx.CacheJmxWrapper になりました。例は次の通りです。
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
name="foo:service=ExampleCacheJmxWrapper">
<attribute name="TransactionManagerLookupClass">
org.jboss.cache.transaction.JBossTransactionManagerLookup
</attribute>
<attribute name="MuxChannelFactory"><inject bean="JChannelFactory"/></attribute>
<attribute name="MultiplexerStack">udp</attribute>
<attribute name="ClusterName">Example-EntityCache</attribute>
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<attribute name="CacheMode">REPL_SYNC</attribute>
<attribute name="InitialStateRetrievalTimeout">15000</attribute>
<attribute name="SyncReplTimeout">20000</attribute>
<attribute name="LockAcquisitionTimeout">15000</attribute>
<attribute name="ExposeManagementStatistics">true</attribute>
</mbean>
</server>CacheJmxWrapper 自体はキャッシュではありません (データの保存などは不可能)。 名前が示す通り、 JMX との統合を処理する org.jboss.cache.Cache 周囲のラッパーになります。 CacheJmxWrapper は、 CacheJmxWrapperMBean MBean インターフェースの Cache 属性を公開します。 キャッシュが必要なサービスは、 この属性よりキャッシュへの参照を取得します。