From ad864a5ed509612375e2a904422e18287dfd5cc5 Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Thu, 21 Dec 2017 13:35:35 +0200 Subject: [PATCH] Use listener as listener in TimeoutingRequest refs #7692 Change-Id: I94aafae16131f3d7a9c688d3861db5b3f56dea1b --- .../org/simantics/db/common/utils/RequestUtil.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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"); -- 2.47.1