try {
rootObjectAndPersistInfo =
/**/objectIOManager
.getObjectAndPersistInfoOfObject(rootOfObjectsToSave);
} catch (final ObjectIOException exception) {
throw new StoreException(exception);
}
rootOfObjectsToSave = null;// NOPMD unreference
session.addToVisit(rootObjectAndPersistInfo);
}
session.setKeepToVisitForSaveRemoveEnabled(true);
markedNotStorableEncountered = false;
markedNotStorableList.clear();
session.initializeKeepToVisitForSave(objectIOManager
.getObjectHavingStateSet());
/*
* for objects known attached to root
*/
while ((objectToVisit = session.nextToVisit()) != null) {// NOPMD
visitOneObjectForSave(objectToVisit, true);
}
/*
* for objects not known attached to root
*/
final Iterator<ObjectAndPersistInfo> iterator = session
.keepToVisitForSaveIterator();
session.setKeepToVisitForSaveRemoveEnabled(false);
saveLoop(iterator, false);
if (!closing) {
final Set<ObjectAndPersistInfo> set = session.getVisitedForSave();
for (ObjectAndPersistInfo objectAndPersistInfo : set) {
try {
if (!mostAccessedObject.contains(objectToVisit)) {
objectAndPersistInfo.unloadAfterSave();
}
} catch (final ObjectIOException exception) {
throw new StoreException(FOR
+ objectAndPersistInfo.toString(),// NOPMD
exception);
} catch (final ObjectIOInvalidClassException exception) {
throw new StoreInvalidClassException(FOR
+ objectAndPersistInfo.toString(), exception);
}
}
}
if (markedNotStorableEncountered) {
/*
* error management when encountered "marked not storable" or
* "not enhanced"
*/
final StringBuilder stringBuilder = new StringBuilder();
if (markedNotStorableEncountered) {
stringBuilder
.append("not marked storable and/or not storable:\n");
for (final ObjectAndPersistInfo notStorable : markedNotStorableList) {
stringBuilder.append(notStorable.toString());
stringBuilder.append('\n');
}
markedNotStorableList.clear();
}
throw new StoreException(stringBuilder.toString());
}
}