Revision: 3342
http://bigdata.svn.sourceforge.net/bigdata/?rev=3342&view=rev
Author: martyncutcher
Date: 2010-07-29 14:49:19 +0000 (Thu, 29 Jul 2010)
Log Message:
-----------
re-instate commit overide, but with protected call to flushWriteCache to guard against concurrency errors!
Modified Paths:
--------------
trunk/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java
Modified: trunk/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java
===================================================================
--- trunk/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java 2010-07-29 14:00:32 UTC (rev 3341)
+++ trunk/bigdata/src/java/com/bigdata/journal/DiskOnlyStrategy.java 2010-07-29 14:49:19 UTC (rev 3342)
@@ -472,6 +472,24 @@
}
/**
+ * Need to overide commit to ensure the writeCache is flushed prior to
+ * writing the rootblock.
+ *
+ * For the DiskOnlyStrategy flushing the writeCache also ensures the
+ * backing file is created if the file is temporary.
+ *
+ * Note that the call must be syncronized or concurrent writers to the
+ * cache will cause problems.
+ */
+ public void commit() {
+ if (writeCache != null) {
+ synchronized(this) {
+ flushWriteCache();
+ }
+ }
+ }
+
+ /**
* Writes the {@link #writeCache} through to the disk and its position is
* reset to zero.
* <p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|