Error management

This commit is contained in:
Fabio Sinibaldi 2022-10-18 15:09:28 +02:00
parent bd5aa2d4d9
commit 4c9455fd76
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package org.gcube.application.geoportal.service.engine.providers.ucd;
import com.mongodb.MongoServerException;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.caches.Engine;
@ -191,7 +192,7 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
// Copying object so we don't alter live Map
UseCaseDescriptor useCaseDescriptor = Serialization.convert(entry.getValue(),UseCaseDescriptor.class);
try {
log.debug("Updateing cache with {}, mongo id is {}", useCaseDescriptor.getId(),useCaseDescriptor.getMongoId());
log.debug("Updating cache with {}, mongo id is {}", useCaseDescriptor.getId(),useCaseDescriptor.getMongoId());
if(useCaseDescriptor.getMongoId()!=null){
log.warn("Retrieved UCD {} from Live Map has a Mongo id [{}]. Removing it..",useCaseDescriptor.getId(),useCaseDescriptor.getMongoId());
useCaseDescriptor.setMongoId(null);
@ -199,7 +200,7 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
// insert/update into DB
manager.insert(useCaseDescriptor);
memCache.put(useCaseDescriptor.getId(), useCaseDescriptor);
} catch (RegistrationException e) {
} catch (RegistrationException | MongoServerException e) {
log.warn("Unable to cache UCD {}",entry.getKey(),e);
}
}