better logging when failing to load field data to memory due to OOM

This commit is contained in:
Shay Banon 2012-01-17 12:58:30 +02:00
parent 7121138803
commit c2ef91afe6
1 changed files with 9 additions and 2 deletions

View File

@ -118,8 +118,15 @@ public abstract class AbstractConcurrentMapFieldDataCache extends AbstractIndexC
synchronized (fieldDataCache) {
fieldData = fieldDataCache.getIfPresent(fieldName);
if (fieldData == null) {
fieldData = FieldData.load(type, reader, fieldName);
fieldDataCache.put(fieldName, fieldData);
try {
fieldData = FieldData.load(type, reader, fieldName);
fieldDataCache.put(fieldName, fieldData);
} catch (OutOfMemoryError e) {
logger.warn("loading field [" + fieldName + "] caused out of memory failure", e);
final OutOfMemoryError outOfMemoryError = new OutOfMemoryError("loading field [" + fieldName + "] caused out of memory failure");
outOfMemoryError.initCause(e);
throw outOfMemoryError;
}
}
}
}