From e90be457f6ee0d5aa93310cde63c7b86b08ca804 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk>
Date: Tue, 25 Sep 2012 13:48:55 +0000
Subject: [PATCH] BIS-185 / Make long-running method calls in IDataStoreService
 use service conversations BIS-196 / Make service conversations timeout
 configurable - report progress manually for getKnownDataSets method

SVN: 26798
---
 .../openbis/dss/generic/server/DataStoreService.java     | 9 +++++++++
 .../cisd/openbis/generic/shared/IDataStoreService.java   | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreService.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreService.java
index 3f12d843eba..a7d188d2a69 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreService.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/DataStoreService.java
@@ -30,6 +30,8 @@ import org.springframework.beans.factory.InitializingBean;
 
 import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked;
 import ch.systemsx.cisd.cifex.rpc.client.ICIFEXComponent;
+import ch.systemsx.cisd.common.conversation.context.ServiceConversationsThreadContext;
+import ch.systemsx.cisd.common.conversation.progress.IServiceConversationProgressListener;
 import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
 import ch.systemsx.cisd.common.exceptions.InvalidAuthenticationException;
 import ch.systemsx.cisd.common.exceptions.InvalidSessionException;
@@ -253,8 +255,13 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic
     {
         sessionTokenManager.assertValidSessionToken(sessionToken);
 
+        IServiceConversationProgressListener listener =
+                ServiceConversationsThreadContext.getProgressListener();
+
         List<String> knownLocations = new ArrayList<String>();
         IShareIdManager manager = getShareIdManager();
+        int index = 0;
+
         for (IDatasetLocation dataSet : dataSets)
         {
             String datasetCode = dataSet.getDataSetCode();
@@ -272,6 +279,8 @@ public class DataStoreService extends AbstractServiceWithLogger<IDataStoreServic
             {
                 manager.releaseLock(datasetCode);
             }
+
+            listener.update("getKnownDataSets", dataSets.size(), ++index);
         }
         return knownLocations;
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java
index 7bc166412b6..bc4d16fc7b9 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java
@@ -60,7 +60,7 @@ public interface IDataStoreService
      * @return locations (as strings) of known data sets
      * @throws InvalidAuthenticationException if <code>sessionToken</code> is invalid.
      */
-    @Conversational(progress = Progress.AUTOMATIC)
+    @Conversational(progress = Progress.MANUAL)
     public List<String> getKnownDataSets(String sessionToken,
             List<? extends IDatasetLocation> dataSets, boolean ignoreNonExistingLocation)
             throws InvalidAuthenticationException;
-- 
GitLab