}
//then for remaining DirectoryProvider
for ( DPWorkspace space : directorySpace.values() ) {
if ( space.needsOptimization() ) {
if ( raisedException == null ) {//avoid optimizations in case of errors or exceptions
OptimizerStrategy optimizerStrategy = space.getOptimizerStrategy();
optimizerStrategy.addTransaction( space.countOperations() );
try {
optimizerStrategy.optimize( this );
}
catch (SearchException e) {
//this will also cause skipping other optimizations:
raisedException = new SearchException( "Exception while optimizing directoryProvider: "
+ space.getDirectory().toString(), e );