import org.simantics.db.request.ExternalRead;
import org.simantics.db.service.QueryControl;
import org.simantics.utils.DataContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class QueryControlImpl implements QueryControl {
-
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(QueryControlImpl.class);
+
final private SessionImplSocket session;
QueryControlImpl(SessionImplSocket session) {
});
} catch (DatabaseException e) {
- e.printStackTrace();
+ LOGGER.error("query flush failed", e);
}
return result.get();
}
}
});
} catch (DatabaseException e) {
- e.printStackTrace();
+ LOGGER.error("query gc failed", e);
}
}
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
throw new PlatformException("Reinstalling Database, NOT IMPLEMENTED");
}
+ boolean serviceModeEntered = false;
+
if (ontologyPolicy == OntologyRecoveryPolicy.Merge) {
message = "Merging ontology changes";
monitor.subTask(message);
session.getService(XSupport.class).setServiceMode(true, createImmutable);
+ // Flush all queries once to allow even immutable request results to be invalidated
+ // because ontology installation affects immutable content and queries related to
+ // immutable content would not get invalidated at all otherwise.
+ if (!serviceModeEntered) {
+ serviceModeEntered = true;
+ session.getService(QueryControl.class).flush();
+ }
+
// Install TG
log.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Installing "+tg.toString()+" - "+tg.getName()));
ImportResult result = TransferableGraphs.importGraph1(session, new TGTransferableGraphSource(tg.getGraph()), advisor, null);
}
}
session.getService(XSupport.class).setServiceMode(false, false);
+ if (serviceModeEntered) {
+ // Flush all queries to ensure that queries that should now
+ // be immutable are not left as mutable in the query cache.
+ session.getService(QueryControl.class).flush();
+ }
}
message = "Ontologies synchronized";
monitor.subTask(message);