jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jackrabbit Wiki] Update of "ConnectionPooling" by MartijnHendriks
Date Thu, 03 Dec 2009 10:42:53 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The "ConnectionPooling" page has been changed by MartijnHendriks.
The comment on this change is: Added documentation on connection pooling.
http://wiki.apache.org/jackrabbit/ConnectionPooling

--------------------------------------------------

New page:
= Database connection pooling =

The forthcoming 2.0 release of Jackrabbit will feature connection pooling for database components
(also see [[http://issues.apache.org/jira/browse/JCR-1456|JCR-1456]]). Connection pooling
has been added to:
 1. The database data store components: ''org.apache.jackrabbit.core.data.db.Db``Data``Store''
and subclasses.
 2. The database filesystem components: ''org.apache.jackrabbit.core.fs.db.Database``File``System''
and subclasses.
 3. The database journal components: ''org.apache.jackrabbit.core.journal.Database``Journal''
and subclasses.
 4. The database bundle persistence managers: ''org.apache.jackrabbit.core.persistence.pool.Bundle``Db``Persistence``Manager''
and subclasses.

'''Important:''' Please note that the pooling implementations of the bundle persistence managers
have not replaced the original implementation but have been added in a separate package.

The components can be configured in the same way as before via the repository descriptor (also
see ConfigurationOverview and [[http://jackrabbit.apache.org/jackrabbit-configuration.html|Jackrabbit
configuration]]). The components that have the same database URL, driver and user will share
the same connection pool (with an unlimited number of connections). Thus, existing deployments
can easily be migrated to use pooling: The only change needed is to replace any bundle persistence
manager class by it's twin brother from the pooling package.

A new configuration element has been added to the repository descriptor: the ''Data``Sources''
element in which you can explicitly configure one or more pooling data sources. Each ''Data``Source''
has a logical name which can be used in the configuration of the above mentioned components.
Here is an example:

{{{
<?xml version="1.0"?>
<Repository>
    <DataSources>
        <DataSource>
            <param name="logicalName" value="ds1"/>
            <param name="driver" value="oracle.jdbc.driver.OracleDriver" />
            <param name="url" value="jdbc:oracle:thin:@localhost:1521:xe" />
            <param name="schema" value="oracle" />
            <param name="user" value="usr" />
            <param name="password" value="pwd" />
            <param name="databaseType" value="oracle"/>
            <param name="validationQuery" value="select 'validationQuery' from dual"/>
            <param name="maxPoolSize" value="10"/>
        </DataSource>
    </DataSources>
    <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
        <param name="dataSourceName" value="ds1"/>
        <param name="schemaObjectPrefix" value="fs_" />
    </FileSystem>
    <DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
        <param name="dataSourceName" value="ds1"/>
        <param name="schemaObjectPrefix" value="ds_" />
    </DataStore>
    <Security appName="Jackrabbit">
        <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security"
/>
        <AccessManager class="org.apache.jackrabbit.core.security.DefaultAccessManager"
/>
        <LoginModule class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule">
           <param name="anonymousId" value="anonymous"/>
           <param name="adminId" value="admin"/>
        </LoginModule>
    </Security>
    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" maxIdleTime="2"/>
    <Workspace name="${wsp.name}">
        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="fs_${wsp.name}_" />
        </FileSystem>
        <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="pm_${wsp.name}_" />
        </PersistenceManager>
        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
            <param name="path" value="${wsp.home}/index"/>
        </SearchIndex>
    </Workspace>
    <Versioning rootPath="${rep.home}/version">
        <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="fs_ver_" />
        </FileSystem>
        <PersistenceManager class="rg.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
            <param name="dataSourceName" value="ds1"/>
            <param name="schemaObjectPrefix" value="pm_ver_" />
        </PersistenceManager>
    </Versioning>
    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
        <param name="path" value="${rep.home}/repository/index"/>
    </SearchIndex>
    <Cluster id="node1">
        <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
            <param name="dataSourceName" value="ds1"/>
            <param name="revision" value="${rep.home}/revision" />
            <param name="schemaObjectPrefix" value="cl_" />
        </Journal>
    </Cluster>
</Repository>
}}}

Note that you can use data sources from JNDI in both the configuration of the data sources
and in configuration of the components (see [[UsingJNDIDataSource|UsingJNDIDataSource]]).
Jackrabbit will use these JNDI data sources as-is and will not wrap pools around them.

The configuration options for the data source elements are the following:

Required properties:
 * logicalName : the logical name of the data source which can be used in the configuration
of database components
 * driver : the driver (which may be ''javax.naming.InitialContext'' for a JNDI data source)
 * url : the database URL (or the JNDI lookup name)
 * dbType : the database type (also called ''schema'' in the configuration of some database
components)

Optional properties (typically used with non-JNDI data sources):
 * user : the database user
 * password : the password for the database user

Optional properties for non-JNDI data sources:
 * validationQuery : the validation query to use (Jackrabbit guesses a default if it is not
specified and logs a warning if it has no proper default)
 * maxPoolSize : the maximum pool size (unlimited by default)

Mime
View raw message