public static <T> T syncWrite(final Function f, final Object ... args) throws DatabaseException {
final SCLContext context = SCLContext.getCurrent();
Object graph = context.get(GRAPH);
- if (graph != null) {
+ if (graph != null && graph instanceof WriteGraph) {
return (T)f.apply(Tuple0.INSTANCE);
} else {
+ if (graph != null) {
+ LOGGER.error(
+ "SCLContext {} for current thread {} contains an existing graph object but it is not WriteGraph - Somewhere is a function that forgets to remove the graph from the context!!",
+ context, Thread.currentThread());
+ }
final SCLReportingHandler printer = (SCLReportingHandler)SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER);
return Simantics.getSession().syncRequest(new WriteResultRequest<T>() {
@Override