@ -340,25 +340,19 @@ public final class plasmaWordIndex implements indexRI {
// get from cache
indexContainer container ;
synchronized ( dhtOutCache ) {
container = dhtOutCache . getContainer ( wordHash , urlselection ) ;
}
synchronized ( dhtInCache ) {
if ( container = = null ) {
container = dhtInCache . getContainer ( wordHash , urlselection ) ;
} else {
container . addAllUnique ( dhtInCache . getContainer ( wordHash , urlselection ) ) ;
}
}
// get from collection index
synchronized ( this ) {
if ( container = = null ) {
container = collections . getContainer ( wordHash , urlselection ) ;
} else {
container . addAllUnique ( collections . getContainer ( wordHash , urlselection ) ) ;
}
}
if ( container = = null ) return null ;
@ -443,11 +437,9 @@ public final class plasmaWordIndex implements indexRI {
public void close ( ) {
dhtInCache . close ( ) ;
dhtOutCache . close ( ) ;
synchronized ( this ) {
collections . close ( ) ;
loadedURL . close ( ) ;
}
}
public indexContainer deleteContainer ( String wordHash ) {
indexContainer c = new indexContainer (
@ -455,29 +447,17 @@ public final class plasmaWordIndex implements indexRI {
indexRWIRowEntry . urlEntryRow ,
dhtInCache . sizeContainer ( wordHash ) + dhtOutCache . sizeContainer ( wordHash ) + collections . indexSize ( wordHash )
) ;
synchronized ( dhtInCache ) {
c . addAllUnique ( dhtInCache . deleteContainer ( wordHash ) ) ;
}
synchronized ( dhtOutCache ) {
c . addAllUnique ( dhtOutCache . deleteContainer ( wordHash ) ) ;
}
synchronized ( this ) {
c . addAllUnique ( collections . deleteContainer ( wordHash ) ) ;
}
return c ;
}
public boolean removeEntry ( String wordHash , String urlHash ) {
boolean removed = false ;
synchronized ( dhtInCache ) {
removed = removed | ( dhtInCache . removeEntry ( wordHash , urlHash ) ) ;
}
synchronized ( dhtOutCache ) {
removed = removed | ( dhtOutCache . removeEntry ( wordHash , urlHash ) ) ;
}
synchronized ( this ) {
removed = removed | ( collections . removeEntry ( wordHash , urlHash ) ) ;
}
return removed ;
}
@ -494,29 +474,17 @@ public final class plasmaWordIndex implements indexRI {
public int removeEntries ( String wordHash , Set < String > urlHashes ) {
int removed = 0 ;
synchronized ( dhtInCache ) {
removed + = dhtInCache . removeEntries ( wordHash , urlHashes ) ;
}
synchronized ( dhtOutCache ) {
removed + = dhtOutCache . removeEntries ( wordHash , urlHashes ) ;
}
synchronized ( this ) {
removed + = collections . removeEntries ( wordHash , urlHashes ) ;
}
return removed ;
}
public String removeEntriesExpl ( String wordHash , Set < String > urlHashes ) {
String removed = "" ;
synchronized ( dhtInCache ) {
removed + = dhtInCache . removeEntries ( wordHash , urlHashes ) + ", " ;
}
synchronized ( dhtOutCache ) {
removed + = dhtOutCache . removeEntries ( wordHash , urlHashes ) + ", " ;
}
synchronized ( this ) {
removed + = collections . removeEntries ( wordHash , urlHashes ) ;
}
return removed ;
}