import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.procedure.Listener;
import org.simantics.db.procedure.Procedure;
import org.simantics.db.request.Read;
public R perform(ReadGraph graph) throws DatabaseException {
if (state.compareAndSet(0, 1)) {
release();
- return wrappedProcedure != null
- ? graph.syncRequest(wrappedRequest, wrappedProcedure)
- : graph.syncRequest(wrappedRequest);
+ if(wrappedProcedure != null) {
+ if(wrappedProcedure instanceof Listener<?>) {
+ return graph.syncRequest(wrappedRequest, (Listener<R>)wrappedProcedure);
+ } else {
+ return graph.syncRequest(wrappedRequest, wrappedProcedure);
+ }
+ } else {
+ return graph.syncRequest(wrappedRequest);
+ }
} else {
if (TRACE_TIMEOUT)
System.out.println("[" + System.currentTimeMillis() + "] canceling execution of request " + wrappedRequest + ", startup timed out");