<html><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>4. Global Properties</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide_slice.html" title="Chapter 12. Distributed Persistence"><link rel="prev" href="slice_configuration.html" title="3. Usage"><link rel="next" href="ch26s05.html" title="5. Per-Slice Properties"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4. Global Properties</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="slice_configuration.html">Prev</a> </td><th width="60%" align="center">Chapter 12. | |
Distributed Persistence | |
</th><td width="20%" align="right"> <a accesskey="n" href="ch26s05.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e31217"></a>4. Global Properties</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch26s04.html#d0e31220">4.1. openjpa.slice.DistributionPolicy</a></span></dt><dt><span class="section"><a href="ch26s04.html#d0e31234">4.2. openjpa.slice.Lenient</a></span></dt><dt><span class="section"><a href="ch26s04.html#d0e31250">4.3. openjpa.slice.Master</a></span></dt><dt><span class="section"><a href="ch26s04.html#d0e31262">4.4. openjpa.slice.Names</a></span></dt><dt><span class="section"><a href="ch26s04.html#d0e31277">4.5. openjpa.slice.ThreadingPolicy</a></span></dt><dt><span class="section"><a href="ch26s04.html#d0e31348">4.6. openjpa.slice.TransactionPolicy</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31220"></a>4.1. openjpa.slice.DistributionPolicy</h3></div></div></div><p> | |
This <span class="emphasis"><em>mandatory</em></span> plug-in property determines how newly | |
persistent instances are distributed across individual slices. | |
The value of this property is a fully-qualified class name that implements | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/slice/DistributionPolicy.html" target="_top"> | |
<code class="classname">org.apache.openjpa.slice.DistributionPolicy</code> | |
</a> interface. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31234"></a>4.2. openjpa.slice.Lenient</h3></div></div></div><p> | |
This boolean plug-in property controls the behavior when one or more slice | |
can not be connected or unavailable for some other reasons. | |
If <code class="code">true</code>, the unreachable slices are ignored. If | |
<code class="code">false</code> then any unreachable slice will raise an exception | |
during startup. | |
</p><p> | |
By default this value is set to <code class="code">false</code> i.e. all configured | |
slices must be available. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31250"></a>4.3. openjpa.slice.Master</h3></div></div></div><p> | |
This plug-in property can be used to identify the name of the master slice. | |
Master slice is used when a primary key is to be generated from a database sequence. | |
</p><p> | |
By default the master slice is the first slice in the list of configured slice names. | |
</p><p> | |
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3> | |
Currently, there is no provision to use sequence from | |
multiple database slices. | |
</div><p> | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31262"></a>4.4. openjpa.slice.Names</h3></div></div></div><p> | |
This plug-in property can be used to register the logical slice names. | |
The value of this property is comma-separated list of slice names. | |
The ordering of the names in this list is | |
<span class="emphasis"><em>significant</em></span> because | |
<a href="slice_configuration.html#distribution_policy" title="3.3. Implement DistributionPolicy interface">DistributionPolicy</a> receives | |
the input argument of the slice names in the same order. | |
</p><p> | |
If logical slice names are not registered explicitly via this property, | |
then all logical slice names available in the persistence unit are | |
registered. The ordering of the slice names in this case is alphabetical. | |
</p><p> | |
If logical slice names are registered explicitly via this property, then | |
any logical slice that is available in the persistence unit but excluded | |
from this list is ignored. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31277"></a>4.5. openjpa.slice.ThreadingPolicy</h3></div></div></div><p> | |
This plug-in property determines the nature of thread pool being used | |
for database operations such as query or flush on individual slices. | |
The value of the property is a | |
fully-qualified class name that implements | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorService.html" target="_top"> | |
<code class="classname">java.util.concurrent.ExecutorService</code> | |
</a> interface. | |
Two pre-defined pools can be chosen via their aliases namely | |
<code class="code">fixed</code> or <code class="code">cached</code>. | |
</p><p> | |
The pre-defined alias <code class="code">cached</code> activates a | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool()" target="_top">cached thread pool</a>. | |
A cached thread pool creates new threads as needed, but will reuse | |
previously constructed threads when they are available. This pool | |
is suitable in scenarios that execute many short-lived asynchronous tasks. | |
The way Slice uses the thread pool to execute database operations is | |
akin to such scenario and hence <code class="code">cached</code> is the default | |
value for this plug-in property. | |
</p><p> | |
The <code class="code">fixed</code> alias activates a | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)" target="_top">fixed thread pool</a>. | |
The fixed thread pool can be further parameterized with | |
<code class="code">CorePoolSize</code>, <code class="code">MaximumPoolSize</code>, | |
<code class="code">KeepAliveTime</code> and <code class="code">RejectedExecutionHandler</code>. | |
The meaning of these parameters are described in | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html" target="_top">JavaDoc</a>. | |
The users can exercise finer control on thread pool behavior via these | |
parameters. | |
By default, the core pool size is <code class="code">10</code>, maximum pool size is | |
also <code class="code">10</code>, keep alive time is <code class="code">60</code> seconds and | |
rejected execution is | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.AbortPolicy.html" target="_top">aborted</a>. | |
</p><p> | |
Both of the pre-defined aliases can be parameterized with a fully-qualified | |
class name that implements | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadFactory.html" target="_top"> | |
<code class="classname">java.util.concurrent.ThreadFactory</code> | |
</a> interface. | |
</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e31348"></a>4.6. openjpa.slice.TransactionPolicy</h3></div></div></div><p> | |
This plug-in property determines the policy for transaction commit | |
across multiple slices. The value of this property is a fully-qualified | |
class name that implements | |
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/transaction/TransactionManager.html" target="_top"> | |
<code class="classname">javax.transaction.TransactionManager</code> | |
</a> interface. | |
</p><p> | |
Three pre-defined policies can be chosen | |
by their aliases namely <code class="code">default</code>, | |
<code class="code">xa</code> and <code class="code">jndi</code>. | |
</p><p> | |
The <code class="code">default</code> policy employs | |
a Transaction Manager that commits or rolls back transaction on individual | |
slices <span class="emphasis"><em>without</em></span> a two-phase commit protocol. | |
It does <span class="emphasis"><em>not</em></span> | |
guarantee atomic nature of transaction across all the slices because if | |
one or more slice fails to commit, there is no way to rollback the transaction | |
on other slices that committed successfully. | |
</p><p> | |
The <code class="code">xa</code> policy employs a Transaction Manager that that commits | |
or rolls back transaction on individual | |
slices using a two-phase commit protocol. The prerequisite to use this scheme | |
is, of course, that all the slices must be configured to use | |
XA-complaint JDBC driver. | |
</p><p> | |
The <code class="code">jndi</code> policy employs a Transaction Manager by looking up the | |
JNDI context. The prerequisite to use this transaction | |
manager is, of course, that all the slices must be configured to use | |
XA-complaint JDBC driver. | |
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3>This JNDI based policy is not available currently.</div><p> | |
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="slice_configuration.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide_slice.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch26s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3. Usage </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 5. Per-Slice Properties</td></tr></table></div></body></html> |