From: Antti Villberg Date: Thu, 21 Dec 2017 11:35:35 +0000 (+0200) Subject: Use listener as listener in TimeoutingRequest X-Git-Tag: v1.43.0~136^2~649 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F1333%2F1;p=simantics%2Fplatform.git Use listener as listener in TimeoutingRequest refs #7692 Change-Id: I94aafae16131f3d7a9c688d3861db5b3f56dea1b --- diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/RequestUtil.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/RequestUtil.java index 3ab4d2644..d1256444b 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/RequestUtil.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/RequestUtil.java @@ -8,6 +8,7 @@ import org.simantics.db.ReadGraph; 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; @@ -95,9 +96,15 @@ public final class RequestUtil { 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)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");