@@ -470,34 +470,28 @@ void cacheValue(long id, LmdbValue value) {
470470 * @throws IOException If an I/O error occurred.
471471 */
472472 public LmdbValue getLazyValue (long id ) throws IOException {
473- long stamp = revisionLock .readLock ();
474- try {
475- // Check value cache
476- Long cacheID = id ;
477- LmdbValue resultValue = cachedValue (cacheID );
478-
479- if (resultValue == null ) {
480- switch ((byte ) (id & 0x3 )) {
481- case URI_VALUE :
482- resultValue = new LmdbIRI (lazyRevision , id );
483- break ;
484- case LITERAL_VALUE :
485- resultValue = new LmdbLiteral (lazyRevision , id );
486- break ;
487- case BNODE_VALUE :
488- resultValue = new LmdbBNode (lazyRevision , id );
489- break ;
490- default :
491- throw new IOException ("Unsupported value with type id " + (id & 0x3 ));
492- }
493- // Store value in cache
494- cacheValue (cacheID , resultValue );
473+ // Check value cache
474+ LmdbValue resultValue = cachedValue (id );
475+
476+ if (resultValue == null ) {
477+ switch ((byte ) (id & 0x3 )) {
478+ case URI_VALUE :
479+ resultValue = new LmdbIRI (lazyRevision , id );
480+ break ;
481+ case LITERAL_VALUE :
482+ resultValue = new LmdbLiteral (lazyRevision , id );
483+ break ;
484+ case BNODE_VALUE :
485+ resultValue = new LmdbBNode (lazyRevision , id );
486+ break ;
487+ default :
488+ throw new IOException ("Unsupported value with type id " + (id & 0x3 ));
495489 }
496-
497- return resultValue ;
498- } finally {
499- revisionLock .unlockRead (stamp );
490+ // Store value in cache
491+ cacheValue (id , resultValue );
500492 }
493+
494+ return resultValue ;
501495 }
502496
503497 /**
@@ -511,8 +505,7 @@ public LmdbValue getValue(long id) throws IOException {
511505 long stamp = revisionLock .readLock ();
512506 try {
513507 // Check value cache
514- Long cacheID = id ;
515- LmdbValue resultValue = cachedValue (cacheID );
508+ LmdbValue resultValue = cachedValue (id );
516509
517510 if (resultValue == null ) {
518511 // Value not in cache, fetch it from file
@@ -521,7 +514,7 @@ public LmdbValue getValue(long id) throws IOException {
521514 if (data != null ) {
522515 resultValue = data2value (id , data , null );
523516 // Store value in cache
524- cacheValue (cacheID , resultValue );
517+ cacheValue (id , resultValue );
525518 }
526519 }
527520
0 commit comments