Commit 5af27f3e authored by Luna Riegel's avatar Luna Riegel
Browse files

Refactor: Code cleaning

parent 6e509ce8
......@@ -247,7 +247,7 @@ public class EmbeddedDatabaseHandler {
}
}
} catch (IOException e) {
throw new RuntimeException(e);
throw new EmbeddedDatabaseHandlerException(e);
}
} catch (SQLException e) {
logger.error(Localization.getText("DatabaseHandler.unmarshallingFailure"), id);
......@@ -285,7 +285,7 @@ public class EmbeddedDatabaseHandler {
}
return objects;
} catch (IOException e) {
throw new RuntimeException(e);
throw new EmbeddedDatabaseHandlerException(e);
}
} catch (SQLException e) {
logger.error(Localization.getText("DatabaseHandler.unmarshallingFailure"), ids);
......
......@@ -52,7 +52,7 @@ public class FeatureCache implements CityObjectCache{
DatabaseCacheLoader.Unmarshaller<GmlId, CityObject> single = handler::unmarshallCityObject;
DatabaseCacheLoader.BatchUnmarshaller<GmlId, CityObject> batch = handler::unmarshallAllIds;
cache = Caffeine.newBuilder().maximumSize(3000).removalListener((GmlId key, CityObject value, RemovalCause cause) -> {
if (value != null && cause.wasEvicted() && isFeatureMarshallable(value)){
if (cause.wasEvicted() && isFeatureMarshallable(value)){
handler.marshallCityObject(value);
}
}).build(new DatabaseCacheLoader<>(single, batch));
......
......@@ -15,4 +15,8 @@ public class EmbeddedDatabaseHandlerException extends RuntimeException{
public EmbeddedDatabaseHandlerException(String message, Throwable cause) {
super(message, cause);
}
public EmbeddedDatabaseHandlerException(Throwable cause){
super(cause);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment