JBoss Community Archive (Read Only)

ModeShape 3

Configuration

There are three ways to configure ModeShape, and it depends on how you're deploying your application.

  1. ModeShape and JBoss AS7 - When ModeShape is installed into JBoss AS7, it is configured using the AS7 configuration and tools (e.g., the command line interface, or CLI). For more details, see Configuring ModeShape in EAP.

  2. ModeShape via JCA - When your application is to be deployed to an environment that supports the Java Connector Architecture (JCA), then you can deploy ModeShape repositories via ModeShape's JCA adapter (available in ModeShape 3.1 or later). See ModeShape's JCA Adapter for more details.

  3. Embedded ModeShape - In all other cases, ModeShape runs within your application, whether your application is a regular Java SE application or a web application deployed to a web container. This means that your application needs to create a single ModeShape engine, deploy a JSON configuration file for each of the repositories needed by your application, and shut down the engine when your application is shut down. See ModeShape in Java applications for more details.

Infinispan Configuration

In all cases, you still need to configure Infinispan. There are a few things to keep in mind:

Minimally, the cache used by a repository needs to be transactional, since ModeShape internally uses transactions and works with client-initiated or container-managed JTA transactions.

Applications that may be concurrently updating the same nodes should use Infinispan configured to use pessimistic locking with the READ_COMMITTED isolation level. By default Infinispan will use optimistic locking; this is more efficient for applications that don't update the same nodes, but concurrently updating the same nodes with optimistic locking may very well cause some updates to be lost. If you're not sure, use pessimistic locking.

The following are some sample Infinispan configuration snippets using a FileCacheStore:

Infinispan Embedded Pessimistic
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:infinispan:config:5.2 http://www.infinispan.org/schemas/infinispan-config-5.2.xsd"
        xmlns="urn:infinispan:config:5.2">

    <global>
        <globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>
    </global>

    <namedCache name="persistentRepository">
        <locking isolationLevel="READ_COMMITTED"/>
        <transaction
                transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
                transactionMode="TRANSACTIONAL"
                lockingMode="PESSIMISTIC"/>
        <loaders
                passivation="false"
                shared="false"
                preload="false">
            <loader
                    class="org.infinispan.loaders.file.FileCacheStore"
                    fetchPersistentState="false"
                    purgeOnStartup="false">
                <properties>
                    <property name="location" value="target/persistent_repository/store"/>
                </properties>
            </loader>
        </loaders>
    </namedCache>
</infinispan>

AS7/EAP will use REPEATABLE_READ as the default isolation level. If an application is concurrently changing the same node, it must make sure to change this default to READ_COMMITTED

Infinispan EAP/AS7 Pessimistic Locking
<local-cache name="sample">
   <locking isolationLevel="READ_COMMITTED"/>
   <!-- ModeShape requires transactions -->
   <transaction mode="NON_XA" locking="PESSIMISTIC"/>
   <!-- Use a cache with file-backed write-through storage. File-backed storage is simple, but not necessarily the fastest. -->
   <file-store passivation="false" path="modeshape/store/sample" relative-to="jboss.server.data.dir" purge="false"/>
</local-cache>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:06:33 UTC, last content change 2014-10-31 12:43:16 UTC.