[tjdo-commits] [CVS tjdo] Refactored the way schema information is organized to minimize memory usa
Brought to you by:
jackknifebarber
From: Mike M. <jac...@us...> - 2007-11-30 19:42:24
|
<html> <head> <style><!-- body {background-color:#ffffff;} .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;} .pathname {font-family:monospace; float:right;} .fileheader {margin-bottom:.5em;} .diff {margin:0;} .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;} .tasklist ul {margin-top:0;margin-bottom:0;} tr.alt {background-color:#eeeeee} #added {background-color:#ddffdd;} #addedchars {background-color:#99ff99;font-weight:bolder;} tr.alt #added {background-color:#ccf7cc;} #removed {background-color:#ffdddd;} #removedchars {background-color:#ff9999;font-weight:bolder;} tr.alt #removed {background-color:#f7cccc;} #info {color:#888888;} #context {background-color:#eeeeee;} td {padding-left:.3em;padding-right:.3em;} tr.head {border-bottom-width:1px;border-bottom-style:solid;} tr.head td {padding:0;padding-top:.2em;} .task {background-color:#ffff00;} .comment {white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd} .error {color:red;} hr {border-width:0px;height:2px;background:black;} --></style> </head> <body> <table cellspacing="0" cellpadding="0" border="0" rules="cols"> <tr class="head"><td colspan="4">Commit in <b><tt>tjdo</tt></b><span id="info"> on MAIN</span></td></tr> <tr><td><tt>docs/<a href="#file1">index.html</a></tt></td><td align="right" id="added">+12</td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">1.26 -> 1.27</td></tr> <tr class="alt"><td><tt> /<a href="#file2">release_history.html</a></tt></td><td align="right" id="added">+3</td><td></td><td nowrap="nowrap" align="center">1.15 -> 1.16</td></tr> <tr><td><tt>src/com/triactive/jdo/<a href="#file3">PersistenceManagerImpl.java</a></tt></td><td align="right" id="added">+3</td><td align="right" id="removed">-42</td><td nowrap="nowrap" align="center">1.27 -> 1.28</td></tr> <tr class="alt"><td><tt> /<a href="#file4">StateManager.java</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-2</td><td nowrap="nowrap" align="center">1.8 -> 1.9</td></tr> <tr><td><tt>src/com/triactive/jdo/state/<a href="#file5">StateManagerImpl.java</a></tt></td><td align="right" id="added">+16</td><td align="right" id="removed">-11</td><td nowrap="nowrap" align="center">1.26 -> 1.27</td></tr> <tr class="alt"><td><tt>src/com/triactive/jdo/store/<a href="#file6"><span id="added">ClassTableManager.java</span></a></tt></td><td align="right" id="added">+42</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr><td><tt> /<a href="#file7"><span id="added">DatastoreOIDGenerator.java</span></a></tt></td><td align="right" id="added">+54</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr class="alt"><td><tt> /<a href="#file8"><span id="added">NondurableOIDGenerator.java</span></a></tt></td><td align="right" id="added">+49</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr><td><tt> /<a href="#file9"><span id="added">OIDGenerator.java</span></a></tt></td><td align="right" id="added">+72</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr class="alt"><td><tt> /<a href="#file10"><span id="added">OIDOverflowException.java</span></a></tt></td><td align="right" id="added">+39</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr><td><tt> /<a href="#file11"><span id="added">RetryableTransaction.java</span></a></tt></td><td align="right" id="added">+252</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr class="alt"><td><tt> /<a href="#file12"><span id="added">SchemaManagerImpl.java</span></a></tt></td><td align="right" id="added">+89</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr><td><tt> /<a href="#file13"><span id="added">TableManager.java</span></a></tt></td><td align="right" id="added">+71</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr class="alt"><td><tt> /<a href="#file14">AbstractMapStore.java</a></tt></td><td align="right" id="added">+13</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.11 -> 1.12</td></tr> <tr><td><tt> /<a href="#file15">AbstractSetStore.java</a></tt></td><td align="right" id="added">+12</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.19 -> 1.20</td></tr> <tr class="alt"><td><tt> /<a href="#file16">ManyToManyMapStore.java</a></tt></td><td align="right" id="added">+110</td><td align="right" id="removed">-101</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr><td><tt> /<a href="#file17">ManyToManySetStore.java</a></tt></td><td align="right" id="added">+79</td><td align="right" id="removed">-50</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr> <tr class="alt"><td><tt> /<a href="#file18">OneToManyMapStore.java</a></tt></td><td align="right" id="added">+93</td><td align="right" id="removed">-79</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr> <tr><td><tt> /<a href="#file19">OneToManySetStore.java</a></tt></td><td align="right" id="added">+71</td><td align="right" id="removed">-42</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr class="alt"><td><tt> /<a href="#file20">StoreManager.java</a></tt></td><td align="right" id="added">+743</td><td align="right" id="removed">-939</td><td nowrap="nowrap" align="center">1.39 -> 1.40</td></tr> <tr><td><tt>src/com/triactive/jdo/store/adapter/<a href="#file21">ColumnInfo.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr class="alt"><td><tt> /<a href="#file22">DatabaseAdapter.java</a></tt></td><td align="right" id="added">+9</td><td align="right" id="removed">-8</td><td nowrap="nowrap" align="center">1.19 -> 1.20</td></tr> <tr><td><tt> /<a href="#file23">ForeignKeyInfo.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr class="alt"><td><tt> /<a href="#file24">IndexInfo.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr><td><tt> /<a href="#file25">OracleAdapter.java</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.12 -> 1.13</td></tr> <tr class="alt"><td><tt> /<a href="#file26">OracleQueryStatement.java</a></tt></td><td align="right" id="added">+8</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file27">PrimaryKeyInfo.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file28">TableInfo.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr><td><tt>src/com/triactive/jdo/store/mapping/<a href="#file29">ColumnMapping.java</a></tt></td><td align="right" id="added">+14</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr> <tr class="alt"><td><tt> /<a href="#file30">ComplexMapping.java</a></tt></td><td align="right" id="added">+8</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr> <tr><td><tt> /<a href="#file31">MapMapping.java</a></tt></td><td align="right" id="added">+29</td><td align="right" id="removed">-20</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr class="alt"><td><tt> /<a href="#file32">Mapping.java</a></tt></td><td align="right" id="added">+13</td><td align="right" id="removed">-11</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file33">ObjectDatastoreIdMapping.java</a></tt></td><td align="right" id="added">+6</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file34">ObjectReferenceDatastoreIdMapping.java</a></tt></td><td align="right" id="added">+9</td><td align="right" id="removed">-8</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr><td><tt> /<a href="#file35">OracleBlobMapping.java</a></tt></td><td align="right" id="added">+6</td><td align="right" id="removed">-6</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr class="alt"><td><tt> /<a href="#file36">OracleClobMapping.java</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file37">SetMapping.java</a></tt></td><td align="right" id="added">+29</td><td align="right" id="removed">-19</td><td nowrap="nowrap" align="center">1.7 -> 1.8</td></tr> <tr class="alt"><td><tt>src/com/triactive/jdo/store/query/<a href="#file38">TjdoSqlQuery.java</a></tt></td><td align="right" id="added">+3</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center">1.10 -> 1.11</td></tr> <tr><td><tt>src/com/triactive/jdo/store/request/<a href="#file39">RequestCache.java</a></tt></td><td align="right" id="added">+22</td><td align="right" id="removed">-50</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr class="alt"><td><tt>src/com/triactive/jdo/store/sql/<a href="#file40">AbstractTable.java</a></tt></td><td align="right" id="added">+38</td><td align="right" id="removed">-96</td><td nowrap="nowrap" align="center">1.8 -> 1.9</td></tr> <tr><td><tt> /<a href="#file41">BaseTable.java</a></tt></td><td align="right" id="added">+102</td><td align="right" id="removed">-55</td><td nowrap="nowrap" align="center">1.11 -> 1.12</td></tr> <tr class="alt"><td><tt> /<a href="#file42">CandidateKey.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-26</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr><td><tt> /<a href="#file43">ClassBaseTable.java</a></tt></td><td align="right" id="added">+97</td><td align="right" id="removed">-89</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr> <tr class="alt"><td><tt> /<a href="#file44">ClassBaseTableExtent.java</a></tt></td><td align="right" id="added">+8</td><td align="right" id="removed">-9</td><td nowrap="nowrap" align="center">1.7 -> 1.8</td></tr> <tr><td><tt> /<a href="#file45">ClassTable.java</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file46">ClassView.java</a></tt></td><td align="right" id="added">+30</td><td align="right" id="removed">-15</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file47">ClassViewExtent.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr class="alt"><td><tt> /<a href="#file48">Column.java</a></tt></td><td align="right" id="added">+48</td><td align="right" id="removed">-27</td><td nowrap="nowrap" align="center">1.7 -> 1.8</td></tr> <tr><td><tt> /<a href="#file49">FieldTable.java</a></tt></td><td align="right" id="added">+20</td><td align="right" id="removed">-18</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr class="alt"><td><tt> /<a href="#file50">ForeignKey.java</a></tt></td><td align="right" id="added">+10</td><td align="right" id="removed">-22</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr><td><tt> /<a href="#file51">Index.java</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-19</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file52">InvalidOidInTableException.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-38</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr> <tr><td><tt> /<a href="#file53">Key.java</a></tt></td><td align="right" id="added">+18</td><td align="right" id="removed">-10</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file54">MapTable.java</a></tt></td><td align="right" id="added">+16</td><td align="right" id="removed">-17</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr><td><tt> /<a href="#file55">PrimaryKey.java</a></tt></td><td align="right" id="added">+2</td><td align="right" id="removed">-15</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr> <tr class="alt"><td><tt> /<a href="#file56">ProbeTable.java</a></tt></td><td align="right" id="added">+10</td><td align="right" id="removed">-13</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr><td><tt> /<a href="#file57">QualifiedName.java</a></tt></td><td align="right" id="added">+32</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center">1.1 -> 1.2</td></tr> <tr class="alt"><td><tt> /<a href="#file58">SchemaTable.java</a></tt></td><td align="right" id="added">+110</td><td align="right" id="removed">-126</td><td nowrap="nowrap" align="center">1.8 -> 1.9</td></tr> <tr><td><tt> /<a href="#file59">SetTable.java</a></tt></td><td align="right" id="added">+14</td><td align="right" id="removed">-14</td><td nowrap="nowrap" align="center">1.3 -> 1.4</td></tr> <tr class="alt"><td><tt> /<a href="#file60">SqlIdentifier.java</a></tt></td><td align="right" id="added">+36</td><td align="right" id="removed">-21</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file61">Table.java</a></tt></td><td align="right" id="added">+44</td><td align="right" id="removed">-17</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr class="alt"><td><tt> /<a href="#file62">View.java</a></tt></td><td align="right" id="added">+27</td><td align="right" id="removed">-17</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file63"><span id="removed">JdoBaseTable.java</span></a></tt></td><td></td><td align="right" id="removed">-87</td><td nowrap="nowrap">1.3 removed</td></tr> <tr class="alt"><td><tt> /<a href="#file64"><span id="removed">JdoTable.java</span></a></tt></td><td></td><td align="right" id="removed">-25</td><td nowrap="nowrap">1.2 removed</td></tr> <tr><td><tt> /<a href="#file65"><span id="removed">JdoView.java</span></a></tt></td><td></td><td align="right" id="removed">-86</td><td nowrap="nowrap">1.3 removed</td></tr> <tr class="alt"><td><tt>src/com/triactive/jdo/store/sql/expr/<a href="#file66">AbstractSqlExpression.java</a></tt></td><td align="right" id="added">+7</td><td align="right" id="removed">-7</td><td nowrap="nowrap" align="center">1.8 -> 1.9</td></tr> <tr><td><tt> /<a href="#file67">BooleanExpression.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.7 -> 1.8</td></tr> <tr class="alt"><td><tt> /<a href="#file68">CandidateSetExpression.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.10 -> 1.11</td></tr> <tr><td><tt> /<a href="#file69">NumericExpression.java</a></tt></td><td align="right" id="added">+3</td><td align="right" id="removed">-3</td><td nowrap="nowrap" align="center">1.5 -> 1.6</td></tr> <tr class="alt"><td><tt> /<a href="#file70">ObjectNondurableIdExpression.java</a></tt></td><td align="right" id="added">+8</td><td align="right" id="removed">-6</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr> <tr><td><tt> /<a href="#file71">QueryStatement.java</a></tt></td><td align="right" id="added">+25</td><td align="right" id="removed">-16</td><td nowrap="nowrap" align="center">1.7 -> 1.8</td></tr> <tr class="alt"><td><tt> /<a href="#file72">SetLiteral.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.6 -> 1.7</td></tr> <tr><td><tt> /<a href="#file73">StringExpression.java</a></tt></td><td align="right" id="added">+5</td><td align="right" id="removed">-8</td><td nowrap="nowrap" align="center">1.2 -> 1.3</td></tr> <tr class="alt"><td><tt> /<a href="#file74">TableExprAsJoins.java</a></tt></td><td align="right" id="added">+4</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr><td><tt>src/com/triactive/jdo/util/<a href="#file75"><span id="added">InternPool.java</span></a></tt></td><td align="right" id="added">+89</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr class="alt"><td><tt> /<a href="#file76">MacroString.java</a></tt></td><td align="right" id="added">+109</td><td align="right" id="removed">-5</td><td nowrap="nowrap" align="center">1.4 -> 1.5</td></tr> <tr><td><tt>test_src/com/triactive/jdo/store/sql/<a href="#file77"><span id="added">TableInternTest.java</span></a></tt></td><td align="right" id="added">+110</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr> <tr><td></td><td align="right" id="added">+3062</td><td align="right" id="removed">-2385</td><td></td></tr> </table> <small id="info">10 added + 3 removed + 64 modified, total 77 files</small><br /> <pre class="comment"> Refactored the way schema information is organized to minimize memory usage. Made info about DB objects (tables, columns, etc.), mappings, cacheable requests, etc. reusable across StoreManagers. Drastically reduces memory footprint when many schemas use the same or similar data models. </pre> <hr /><a name="file1" /><div class="file"> <span class="pathname">tjdo/docs</span><br /> <div class="fileheader"><big><b>index.html</b></big> <small id="info">1.26 -> 1.27</small></div> <pre class="diff"><small id="info">diff -u -r1.26 -r1.27 --- index.html 11 Oct 2006 23:37:23 -0000 1.26 +++ index.html 30 Nov 2007 19:42:23 -0000 1.27 @@ -11,7 +11,7 @@ </small></pre><pre class="diff" id="context"> <body> <h1>TriActive Java Data Objects</h1> Release: $Name: $<br/> </pre><pre class="diff" id="removed">-Updated: $Date: 200<span id="removedchars">6/10/11 23:37</span>:23 $<br/> </pre><pre class="diff" id="added">+Updated: $Date: 200<span id="addedchars">7/11/30 19:42</span>:23 $<br/> </pre><pre class="diff" id="context"> <p> TriActive JDO (TJDO) is an implementation of Sun's <a href="http://access1.sun.com/jdo">Java Data Objects</a> specification. </pre><pre class="diff"><small id="info">@@ -379,6 +379,17 @@ </small></pre><pre class="diff" id="context"> </td> </tr> <tr> </pre><pre class="diff" id="added">+ <td>com.triactive.jdo.store.schemaIdleExpirationHours</td> + <td>Integer &gt; 0</td> + <td>"24"</td> + <td> + The amount of time in hours after which knowledge of a specific database + schema is considered stale and eligible for discarding. + Discarding is equivalent to SchemaManager.reset(). + Default is 24 hours. + </td> + </tr> + <tr> </pre><pre class="diff" id="context"> <td>com.triactive.jdo.store.timeDiffTolerance</td> <td>Integer &ge; 0</td> <td>"10000"</td> </pre></div> <hr /><a name="file2" /><div class="file"> <span class="pathname">tjdo/docs</span><br /> <div class="fileheader"><big><b>release_history.html</b></big> <small id="info">1.15 -> 1.16</small></div> <pre class="diff"><small id="info">diff -u -r1.15 -r1.16 --- release_history.html 11 May 2007 20:42:37 -0000 1.15 +++ release_history.html 30 Nov 2007 19:42:23 -0000 1.16 @@ -54,6 +54,9 @@ </small></pre><pre class="diff" id="context"> <li>Modified column naming to allow a class named Foo to have a field named fooID.</li> </pre><pre class="diff" id="added">+ <li>Modified the way schema information is managed to reduce memory footprint when + many schemas use the same or similar data models.</li> + </pre><pre class="diff" id="context"> <li>Modified the way catalog metadata and JDO_TABLE are accessed to improve performance.</li> <li>Bugs </pre></div> <hr /><a name="file3" /><div class="file"> <span class="pathname">tjdo/src/com/triactive/jdo</span><br /> <div class="fileheader"><big><b>PersistenceManagerImpl.java</b></big> <small id="info">1.27 -> 1.28</small></div> <pre class="diff"><small id="info">diff -u -r1.27 -r1.28 --- PersistenceManagerImpl.java 3 Oct 2007 01:20:35 -0000 1.27 +++ PersistenceManagerImpl.java 30 Nov 2007 19:42:24 -0000 1.28 @@ -5,7 +5,7 @@ </small></pre><pre class="diff" id="context"> * This software is distributed under the terms of the TJDO License version 1.0. * See the terms of the TJDO License in the documentation provided with this software. * </pre><pre class="diff" id="removed">- * $Id: PersistenceManagerImpl.java,v 1.2<span id="removedchars">7 2007/10/03 01:20:35</span> jackknifebarber Exp $ </pre><pre class="diff" id="added">+ * $Id: PersistenceManagerImpl.java,v 1.2<span id="addedchars">8 2007/11/30 19:42:24</span> jackknifebarber Exp $ </pre><pre class="diff" id="context"> */ package com.triactive.jdo; </pre><pre class="diff"><small id="info">@@ -17,7 +17,6 @@ </small></pre><pre class="diff" id="context"> import com.triactive.jdo.store.StoreManager; import com.triactive.jdo.store.query.JdoqlQuery; import com.triactive.jdo.store.query.TjdoSqlQuery; </pre><pre class="diff" id="removed">-import com.triactive.jdo.store.sql.ClassTable; </pre><pre class="diff" id="context"> import com.triactive.jdo.util.WeakValueMap; import java.io.PrintWriter; import java.sql.Connection; </pre><pre class="diff"><small id="info">@@ -45,7 +44,7 @@ </small></pre><pre class="diff" id="context"> * Implements the PersistenceManager interface. * * @author <a href="mailto:jac...@us...">Mike Martin</a> </pre><pre class="diff" id="removed">- * @version $Revision: 1.2<span id="removedchars">7</span> $ </pre><pre class="diff" id="added">+ * @version $Revision: 1.2<span id="addedchars">8</span> $ </pre><pre class="diff" id="context"> */ public class PersistenceManagerImpl implements PersistenceManager </pre><pre class="diff"><small id="info">@@ -902,45 +901,7 @@ </small></pre><pre class="diff" id="context"> private Class getClassForObjectID(Object id, Class contextClass) { if (id instanceof OID) </pre><pre class="diff" id="removed">- { - int classID = ((OID)id).getClassID(); - ClassTable ct = null; - - try - { - ct = (ClassTable)srm.getTable(classID); - } - catch (ClassCastException e) - { - throw new JDOUserException("Not a class table, ID = " + classID, e); - } - - if (ct == null) - { - /* - * The ClassTable for this class ID has not yet been initialized. - * Ask the store manager which class name it corresponds to. - */ - Class c; - - try - { - c = srm.getClassFinder().classForName(srm.getJavaName(classID), true, contextClass); - } - catch (ClassNotFoundException e) - { - throw new JDOUserException("Class not found, ID = " + classID, e); - } - - /* - * We know the answer here, but make sure its ClassTable gets - * initialized as a side effect. - */ - ct = srm.getTable(c); - } - - return ct.getType(); - } </pre><pre class="diff" id="added">+ return srm.getClassTable(((OID)id).getClassID(), contextClass).getType(); </pre><pre class="diff" id="context"> else if (id instanceof SCOID) return ((SCOID)id).getSCOClass(); else </pre></div> <hr /><a name="file4" /><div class="file"> <span class="pathname">tjdo/src/com/triactive/jdo</span><br /> <div class="fileheader"><big><b>StateManager.java</b></big> <small id="info">1.8 -> 1.9</small></div> <pre class="diff"><small id="info">diff -u -r1.8 -r1.9 --- StateManager.java 22 Aug 2005 17:53:40 -0000 1.8 +++ StateManager.java 30 Nov 2007 19:42:24 -0000 1.9 @@ -1,15 +1,16 @@ </small></pre><pre class="diff" id="context"> /* </pre><pre class="diff" id="removed">- * Copyright 2004 (C) TJDO. </pre><pre class="diff" id="added">+ * Copyright 2004<span id="addedchars">-2007</span> (C) TJDO. </pre><pre class="diff" id="context"> * All rights reserved. * * This software is distributed under the terms of the TJDO License version 1.0. * See the terms of the TJDO License in the documentation provided with this software. * </pre><pre class="diff" id="removed">- * $Id: StateManager.java,v 1.<span id="removedchars">8 2005/08/22 17:53:40</span> jackknifebarber Exp $ </pre><pre class="diff" id="added">+ * $Id: StateManager.java,v 1.<span id="addedchars">9 2007/11/30 19:42:24</span> jackknifebarber Exp $ </pre><pre class="diff" id="context"> */ package com.triactive.jdo; </pre><pre class="diff" id="added">+import com.triactive.jdo.store.StoreManager; </pre><pre class="diff" id="context"> import java.io.PrintWriter; import javax.jdo.spi.PersistenceCapable; </pre><pre class="diff"><small id="info">@@ -22,6 +23,8 @@ </small></pre><pre class="diff" id="context"> PersistenceManager getPersistenceManager(); </pre><pre class="diff" id="added">+ StoreManager getStoreManager(); + </pre><pre class="diff" id="context"> boolean makePersistent(); void makeDirty(int fieldNumber); </pre></div> <hr /><a name="file5" /><div class="file"> <span class="pathname">tjdo/src/com/triactive/jdo/state</span><br /> <div class="fileheader"><big><b>StateManagerImpl.java</b></big> <small id="info">1.26 -> 1.27</small></div> <pre class="diff"><small id="info">diff -u -r1.26 -r1.27 --- StateManagerImpl.java 2 Aug 2006 22:41:24 -0000 1.26 +++ StateManagerImpl.java 30 Nov 2007 19:42:24 -0000 1.27 @@ -1,11 +1,11 @@ </small></pre><pre class="diff" id="context"> /* </pre><pre class="diff" id="removed">- * Copyright 2004 (C) TJDO. </pre><pre class="diff" id="added">+ * Copyright 2004<span id="addedchars">-2007</span> (C) TJDO. </pre><pre class="diff" id="context"> * All rights reserved. * * This software is distributed under the terms of the TJDO License version 1.0. * See the terms of the TJDO License in the documentation provided with this software. * </pre><pre class="diff" id="removed">- * $Id: StateManagerImpl.java,v 1.2<span id="removedchars">6 2006/08/02 22:41</span>:24 jackknifebarber Exp $ </pre><pre class="diff" id="added">+ * $Id: StateManagerImpl.java,v 1.2<span id="addedchars">7 2007/11/30 19:42</span>:24 jackknifebarber Exp $ </pre><pre class="diff" id="context"> */ package com.triactive.jdo.state; </pre><pre class="diff"><small id="info">@@ -38,7 +38,7 @@ </small></pre><pre class="diff" id="context"> * This class implements the StateManager. * * @author <a href="mailto:mma...@au...">Mike Martin</a> </pre><pre class="diff" id="removed">- * @version $Revision: 1.2<span id="removedchars">6</span> $ </pre><pre class="diff" id="added">+ * @version $Revision: 1.2<span id="addedchars">7</span> $ </pre><pre class="diff" id="context"> */ public class StateManagerImpl implements com.triactive.jdo.StateManager </pre><pre class="diff"><small id="info">@@ -588,6 +588,11 @@ </small></pre><pre class="diff" id="context"> return myPM; } </pre><pre class="diff" id="added">+ public StoreManager getStoreManager() + { + return myPM.getStoreManager(); + } + </pre><pre class="diff" id="context"> /** * Return the object representing the JDO identity of the calling instance. </pre><pre class="diff"><small id="info">@@ -848,7 +853,7 @@ </small></pre><pre class="diff" id="context"> * manually perform a minimum lookup operation to confirm existence. */ if (cmd.getDefaultFetchGroupFieldNumbers().length != 0) </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().lookup(this); </pre><pre class="diff" id="added">+ getStoreManager().lookup(this); </pre><pre class="diff" id="context"> retrieve(true); } </pre><pre class="diff"><small id="info">@@ -890,7 +895,7 @@ </small></pre><pre class="diff" id="context"> int[] fieldNumbers = fieldsWhereFlagIs(dfgFieldNumbers, LOADED, false); if (fieldNumbers != null) </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="added">+ getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="context"> postLoad(); } </pre><pre class="diff"><small id="info">@@ -905,7 +910,7 @@ </small></pre><pre class="diff" id="context"> private void loadNonDFGField(int fieldNumber) { </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().fetch(this, new int[] { fieldNumber }); </pre><pre class="diff" id="added">+ getStoreManager().fetch(this, new int[] { fieldNumber }); </pre><pre class="diff" id="context"> } </pre><pre class="diff"><small id="info">@@ -922,7 +927,7 @@ </small></pre><pre class="diff" id="context"> { boolean dfgWasAlreadyLoaded = isDFGLoaded(); </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="added">+ getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="context"> /* If the DFG was not already loaded, it is now. */ if (!dfgWasAlreadyLoaded) </pre><pre class="diff"><small id="info">@@ -944,7 +949,7 @@ </small></pre><pre class="diff" id="context"> { resetFieldFlags(); </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="added">+ getStoreManager().fetch(this, fieldNumbers); </pre><pre class="diff" id="context"> } if (isDFGLoaded()) </pre><pre class="diff"><small id="info">@@ -1992,7 +1997,7 @@ </small></pre><pre class="diff" id="context"> try { </pre><pre class="diff" id="removed">- StoreManager srm = <span id="removedchars">myPM.</span>getStoreManager(); </pre><pre class="diff" id="added">+ StoreManager srm = getStoreManager(); </pre><pre class="diff" id="context"> myID = srm.newObjectID(myPC.getClass()); if (getFlag(INSERTING)) </pre><pre class="diff"><small id="info">@@ -2157,7 +2162,7 @@ </small></pre><pre class="diff" id="context"> try { if (!noStore) </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().delete(this); </pre><pre class="diff" id="added">+ getStoreManager().delete(this); </pre><pre class="diff" id="context"> resetFieldFlags(); </pre><pre class="diff"><small id="info">@@ -2211,7 +2216,7 @@ </small></pre><pre class="diff" id="context"> if (dirtyFieldNumbers == null) throw new JDOFatalInternalException("dirty == true but no fields are marked dirty"); </pre><pre class="diff" id="removed">- <span id="removedchars">myPM.</span>getStoreManager().update(this, dirtyFieldNumbers); </pre><pre class="diff" id="added">+ getStoreManager().update(this, dirtyFieldNumbers); </pre><pre class="diff" id="context"> clearDirtyFlags(); } </pre></div> <hr /><a name="file6" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>ClassTableManager.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N ClassTableManager.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ClassTableManager.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,42 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: ClassTableManager.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + +import com.triactive.jdo.store.sql.ClassTable; +import com.triactive.jdo.store.sql.TableMetadata; + + +/** + * A table manager specialized for {@link ClassTable class tables}. + * Class tables can have OIDs generated for them. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +class ClassTableManager extends TableManager +{ + private OIDGenerator oidGenerator; + + + public ClassTableManager(TableMetadata tmd, ClassTable table) + { + super(tmd, table); + } + + public OIDGenerator getOIDGenerator() + { + if (oidGenerator == null) + oidGenerator = ((ClassTable)table).newOIDGenerator(tableId); + + return oidGenerator; + } +} </pre></div> <hr /><a name="file7" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>DatastoreOIDGenerator.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N DatastoreOIDGenerator.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ DatastoreOIDGenerator.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,54 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: DatastoreOIDGenerator.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + + +/** + * An OID generator backed by the sequences in JDO_TABLE. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +public class DatastoreOIDGenerator extends OIDGenerator +{ + /** + * Constructs a new datastore OID generator. + * + * @param classId + * the class ID of OIDs to generate. + */ + public DatastoreOIDGenerator(int classId) + { + super(classId); + + /* -1 means "need another value from the datastore sequence". */ + nextHiValue = -1; + } + + public OID next(StoreManager storeMgr) + { + if (nextHiValue < 0) + { + if ((nextHiValue = storeMgr.getNextOIDHiValue(classId)) >= OID.MAX_OBJIDHI) + throw new OIDOverflowException(classId); + + nextLoValue = 0; + } + + OID id = new OID(classId, nextHiValue, nextLoValue); + + if (nextLoValue++ == OID.MAX_OBJIDLO) + nextHiValue = -1; + + return id; + } +} </pre></div> <hr /><a name="file8" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>NondurableOIDGenerator.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N NondurableOIDGenerator.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ NondurableOIDGenerator.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,49 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: NondurableOIDGenerator.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + + +/** + * An OID generator backed solely by memory. + * This generator always starts at hi=0,lo=0 and increments by one. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +public class NondurableOIDGenerator extends OIDGenerator +{ + /** + * Constructs a new non-durable OID generator. + * + * @param classId + * the class ID of OIDs to generate. + */ + public NondurableOIDGenerator(int classId) + { + super(classId); + } + + public OID next(StoreManager storeMgr) + { + OID id = new OID(classId, nextHiValue, nextLoValue); + + if (nextLoValue++ == OID.MAX_OBJIDLO) + { + if (nextHiValue++ == OID.MAX_OBJIDHI) + throw new OIDOverflowException(classId); + + nextLoValue = 0; + } + + return id; + } +} </pre></div> <hr /><a name="file9" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>OIDGenerator.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N OIDGenerator.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ OIDGenerator.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,72 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: OIDGenerator.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + + +/** + * Generates OIDs for a single class of objects. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +public abstract class OIDGenerator +{ + /** The class ID of OIDs to generate. */ + protected final short classId; + /** The hi value of the next OID to be returned. */ + protected int nextHiValue; + /** The lo value of the next OID to be returned. */ + protected short nextLoValue; + + /** + * Constructs a new OID generator. + * + * @param classId + * the class ID of OIDs to generate. + */ + public OIDGenerator(int classId) + { + this.classId = (short)classId; + } + + /** + * Returns the lowest possible OID value for the class of OIDs returned by + * this generator. + */ + public final OID minimum() + { + return new OID(classId, 0, 0); + } + + /** + * Returns the highest possible OID value for the class of OIDs returned by + * this generator. + */ + public final OID maximum() + { + return new OID(classId, OID.MAX_OBJIDHI, OID.MAX_OBJIDLO); + } + + /** + * Generates the next unique OID value. + * + * @param storeMgr + * the store manager to use for accessing datastore-based sequence(s), + * if necessary. + * + * @return + * the next unique OID + * @throws OIDOverflowException + * if the generator can produce no more values + */ + public abstract OID next(StoreManager storeMgr) throws OIDOverflowException; +} </pre></div> <hr /><a name="file10" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>OIDOverflowException.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N OIDOverflowException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ OIDOverflowException.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,39 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: OIDOverflowException.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + +import javax.jdo.JDOFatalException; + + +/** + * A <tt>OIDOverflowException</tt> is thrown if no more OIDs can be generated + * for a given class of objects. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +public class OIDOverflowException extends JDOFatalException +{ + private static final long serialVersionUID = 7864235690876234L; + + /** + * Constructs an OID overflow exception. + * + * @param classID + * The class ID for which no more values are available. + */ + public OIDOverflowException(int classID) + { + super("OID overflow, class ID = " + classID); + } +} + </pre></div> <hr /><a name="file11" /><div class="file"> <span class="pathname" id="added">tjdo/src/com/triactive/jdo/store</span><br /> <div class="fileheader" id="added"><big><b>RetryableTransaction.java</b></big> <small id="info">added at 1.1</small></div> <pre class="diff"><small id="info">diff -N RetryableTransaction.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ RetryableTransaction.java 30 Nov 2007 19:42:24 -0000 1.1 @@ -0,0 +1,252 @@ </small></pre><pre class="diff" id="added">+/* + * Copyright 2007 (C) TJDO. + * All rights reserved. + * + * This software is distributed under the terms of the TJDO License version 1.0. + * See the terms of the TJDO License in the documentation provided with this software. + * + * $Id: RetryableTransaction.java,v 1.1 2007/11/30 19:42:24 jackknifebarber Exp $ + */ + +package com.triactive.jdo.store; + +import com.triactive.jdo.jdbc.InitializedConnectionFactory; +import com.triactive.jdo.store.adapter.DatabaseAdapter; +import com.triactive.jdo.store.adapter.SqlState; +import com.triactive.jdo.util.SystemProperty; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Collection; +import java.util.Iterator; +import javax.jdo.JDODataStoreException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * An abstract base class for JDBC transactions that can be retried in the face + * of transient failures. + * Subclasses must override, among others, the {@link #execute(int)} method to + * implement the body of the transaction. + * Users call the {@link #execute()} method to execute the transaction. + * + * @author <a href="mailto:jac...@us...">Mike Martin</a> + * @version $Revision: 1.1 $ + */ + +public abstract class RetryableTransaction +{ + private static final Log LOG = LogFactory.getLog(RetryableTransaction.class); + + private final int isolationLevel; + private final int maxRetries; + protected Connection conn; + + + /** + * Constructs a new transaction having the given isolation level. + * The maximum number of retries is taken from the system property + * <tt>com.triactive.jdo.store.maxRetries</tt>, or defaults to 3 if not set. + * + * @param isolationLevel + * One of the isolation level constants from java.sql.Connection. + */ + public RetryableTransaction(int isolationLevel) + { + this(isolationLevel, SystemProperty.intValue("com.triactive.jdo.store.maxRetries", 3)); + } + + /** + * Constructs a new transaction having the given isolation + * level and number of retries. + * + * @param isolationLevel + * One of the isolation level constants from java.sql.Connection. + * @param maxRetries + * The maximum number of times the transaction will be tried. The + * value includes the first attempt. + */ + public RetryableTransaction(int isolationLevel, int maxRetries) + { + this.isolationLevel = isolationLevel; + this.maxRetries = maxRetries; + } + + /** + * Returns the connection factory from which this object obtains its JDBC + * connections. + * Subclasses override this method to provide a specific factory. + */ + protected abstract InitializedConnectionFactory getConnectionFactory(); + + /** + * Returns the database adapter associated with connections provided by + * this object's connection factory. + * Subclasses override this method to provide a specific adapter. + */ + public abstract DatabaseAdapter getDatabaseAdapter(); + + /** + * Executes the transaction. + * <p> + * A database connection is acquired and the {@link #execute(int)} method + * is invoked. + * If the selected isolation level is not Connection.TRANSACTION_NONE, then + * commit() or rollback() is called on the connection according to whether + * the invocation succeeded or threw an exception. + * <p> + * If the invocation fails due to a SQLException, and the failure is + * considered worth retrying, the transaction is repeated up to the + * specified number of retries. + * "Worth retrying" is defined by the exception's {@link SqlState SQLSTATE} + * code. + * If the driver doesn't provide SQLSTATE codes then all exceptions are + * considered worth retrying. + * + * @return + * The value returned by the {@link #execute(int) inner execute + * method}. + * @exception JDODataStoreException + * If a SQL exception occurred even after retrying. + * + * @see SqlState#isWorthRetrying + */ + public final Object execute() + { + Object retval; + int attempts = 0; + + for (;;) + { + try + { + conn = getConnectionFactory().getConnection(isolationLevel); + + try + { + boolean succeeded = false; + + try + { + retval = execute(attempts); + succeeded = true; + } + finally + { + if (isolationLevel != Connection.TRANSACTION_NONE) + { + if (succeeded) + conn.commit(); + else + conn.rollback(); + } + } + } + finally + { + try + { + conn.close(); + } + finally + { + conn = null; + } + } + + break; + } + catch (SQLException e) + { + if (++attempts < maxRetries) + { + SqlState state = getDatabaseAdapter().getSqlState(e); + + if (state == null || state.isWorthRetrying()) + { + LOG.info("SQL exception " + e + " during " + this + ", attempt " + attempts + " of " + maxRetries); + continue; + } + } + + throw new JDODataStoreException("SQL exception: " + this, e); + } + } + + return retval; + } + + /** + * Returns the JDBC connection currently being used by the transaction. + * + * @throws IllegalStateException + * if the transaction object is not in the process of being executed + */ + public final Connection getConnection() + { + if (conn == null) + throw new IllegalStateException("Tran... [truncated message content] |