예제 #1
0
 @Override
 public long ramBytesUsed() {
   long ramBytesUsed = BASE_RAM_BYTES_USED;
   ramBytesUsed += (postingsReader != null) ? postingsReader.ramBytesUsed() : 0;
   ramBytesUsed += (indexReader != null) ? indexReader.ramBytesUsed() : 0;
   ramBytesUsed += fields.size() * 2L * RamUsageEstimator.NUM_BYTES_OBJECT_REF;
   for (FieldReader reader : fields.values()) {
     ramBytesUsed += reader.ramBytesUsed();
   }
   return ramBytesUsed;
 }
예제 #2
0
 @Override
 public void close() throws IOException {
   try {
     try {
       if (indexReader != null) {
         indexReader.close();
       }
     } finally {
       // null so if an app hangs on to us (ie, we are not
       // GCable, despite being closed) we still free most
       // ram
       indexReader = null;
       if (in != null) {
         in.close();
       }
     }
   } finally {
     if (postingsReader != null) {
       postingsReader.close();
     }
   }
 }