You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/06/07 17:20:19 UTC
svn commit: r1347669 -
/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java
Author: andy
Date: Thu Jun 7 15:20:19 2012
New Revision: 1347669
URL: http://svn.apache.org/viewvc?rev=1347669&view=rev
Log:
JENA-250
Modified:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java?rev=1347669&r1=1347668&r2=1347669&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrCache.java Thu Jun 7 15:20:19 2012
@@ -243,24 +243,14 @@ public class BlockMgrCache extends Block
synchronized
public void sync()
{
- if ( true )
- {
- String x = "" ;
- if ( indexName != null )
- x = indexName+" : ";
- log("%sH=%d, M=%d, W=%d", x, cacheReadHits, cacheMisses, cacheWriteHits) ;
- }
-
- if ( writeCache != null )
- log("sync (%d blocks)", writeCache.size()) ;
- else
- log("sync") ;
- boolean somethingWritten = syncFlush() ;
- // Sync the wrapped object
- if ( somethingWritten )
- log("sync underlying BlockMgr") ;
- else
- log("Empty sync") ;
+ _sync(false) ;
+ }
+
+ @Override
+ synchronized
+ public void syncForce()
+ {
+ _sync(true) ;
}
@Override
@@ -289,6 +279,31 @@ public class BlockMgrCache extends Block
log.debug(msg) ;
}
+ private void _sync(boolean force)
+ {
+ if ( true )
+ {
+ String x = "" ;
+ if ( indexName != null )
+ x = indexName+" : ";
+ log("%sH=%d, M=%d, W=%d", x, cacheReadHits, cacheMisses, cacheWriteHits) ;
+ }
+
+ if ( writeCache != null )
+ log("sync (%d blocks)", writeCache.size()) ;
+ else
+ log("sync") ;
+ boolean somethingWritten = syncFlush() ;
+ // Sync the wrapped object
+ if ( somethingWritten || force )
+ {
+ log("sync underlying BlockMgr") ;
+ super.sync() ;
+ }
+ else
+ log("Empty sync") ;
+ }
+
private boolean syncFlush()
{
if ( writeCache == null ) return false ;