You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by bu...@apache.org on 2017/10/19 10:27:50 UTC

svn commit: r1019771 - in /websites/staging/jena/trunk/content: ./ documentation/tdb/faqs.html

Author: buildbot
Date: Thu Oct 19 10:27:50 2017
New Revision: 1019771

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/tdb/faqs.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Oct 19 10:27:50 2017
@@ -1 +1 @@
-1812305
+1812613

Modified: websites/staging/jena/trunk/content/documentation/tdb/faqs.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/tdb/faqs.html (original)
+++ websites/staging/jena/trunk/content/documentation/tdb/faqs.html Thu Oct 19 10:27:50 2017
@@ -236,14 +236,28 @@ load with a mixture of queries and updat
 <a href="tdb_transactions.html">transactions</a> are implemented for TDB.</p>
 <p>TDB uses write-ahead logging so new data is written both to an on-disk journal and kept in-memory.  This is necessary because TDB permits
 a single writer and multiple readers at any one time and readers are guaranteed to always see the state of the database at the time they
-started reading.  Therefore until there are no active readers it is not possible to update the database directly since readers are actively
+started reading.  Therefore, until there are no active readers it is not possible to update the database directly since readers are actively
 accessing it hence why a journal is used.  The in-memory journal holds some memory that cannot be freed up until such time as the database
 has no active readers/writers and the changes it holds can be safely flushed to disk.</p>
 <p>This means that in scenarios where there is continuous high load on the system TDB never reaches a state where it is able to flush the journal
 eventually causing out of memory errors in Fuseki.  You can see if you are experiencing this issue by examining your database directory, if it
 contains a <code>.jrnl</code> file that is non-empty then Fuseki/TDB is having to hold the journal in-memory.</p>
-<p><strong>However</strong> because this relates to transactional use and the journal is also stored on disk no data will be lost, by stopping and restarting 
-Fuseki the journal will be flushed to disk.</p>
+<p><strong>However</strong>, because this relates to transactional use and the journal is also stored on disk no data will be lost, by stopping and restarting 
+Fuseki the journal will be flushed to disk. When using the <a href="java_api.html">TDB Java API</a>, the journal can be flushed by closing any datasets and releasing the TDB resources.</p>
+<div class="codehilite"><pre>  <span class="n">Dataset</span> <span class="n">dataset</span> <span class="p">=</span> <span class="n">TDBFactory</span><span class="p">.</span><span class="n">createDataset</span><span class="p">(</span><span class="n">directory</span><span class="p">)</span> <span class="p">;</span>
+  <span class="k">try</span><span class="p">{</span>
+     <span class="p">...</span>
+     <span class="n">dataset</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="n">ReadWrite</span><span class="p">.</span><span class="n">READ</span><span class="p">)</span> <span class="p">;</span>
+     <span class="o">//</span> <span class="n">Perform</span> <span class="n">operations</span>      
+     <span class="n">dataset</span><span class="p">.</span><span class="k">end</span><span class="p">()</span> <span class="p">;</span>
+     <span class="p">...</span> 
+  <span class="p">}</span><span class="n">finally</span><span class="p">{</span>
+     <span class="n">dataset</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
+     <span class="n">TDBFactory</span><span class="p">.</span><span class="n">release</span><span class="p">(</span><span class="n">dataset</span><span class="p">);</span>
+  <span class="p">}</span>
+</pre></div>
+
+
 <p><a name="ssd"></a></p>
 <h2 id="should-i-use-a-ssd">Should I use a SSD?<a class="headerlink" href="#should-i-use-a-ssd" title="Permanent link">&para;</a></h2>
 <p>Yes if you are able to</p>