From cf469dbc40ce9ee265644dae35d9261e1863414a Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 16 Feb 2016 08:01:34 +0000
Subject: [PATCH] SSDM-3130: fixing bug (revealed in integration test): Eager
 shuffling in post-registration throws an exception.

SVN: 35684
---
 .../cisd/etlserver/path/PathInfoDatabaseFeedingTask.java    | 5 +++++
 .../postregistration/AbstractPostRegistrationTask.java      | 5 +++++
 .../cisd/etlserver/postregistration/EagerShufflingTask.java | 6 ++++++
 .../etlserver/postregistration/IPostRegistrationTask.java   | 5 +++++
 .../postregistration/PostRegistrationMaintenanceTask.java   | 1 +
 5 files changed, 22 insertions(+)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java
index 041e03a5786..f2bc5a997b4 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/path/PathInfoDatabaseFeedingTask.java
@@ -212,6 +212,11 @@ public class PathInfoDatabaseFeedingTask implements IMaintenanceTask, IPostRegis
         operationLog.info("Feeding finished.");
     }
     
+    @Override
+    public void clearCache()
+    {
+    }
+
     private List<SimpleDataSetInformationDTO> filteredDataSets(List<SimpleDataSetInformationDTO> dataSets, Set<String> processedDataSets)
     {
         List<SimpleDataSetInformationDTO> result = new ArrayList<>();
diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/AbstractPostRegistrationTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/AbstractPostRegistrationTask.java
index 78fb8924a9b..15c31fa8913 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/AbstractPostRegistrationTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/AbstractPostRegistrationTask.java
@@ -35,4 +35,9 @@ public abstract class AbstractPostRegistrationTask implements IPostRegistrationT
         this.properties = properties;
         this.service = service;
     }
+
+    @Override
+    public void clearCache()
+    {
+    }
 }
\ No newline at end of file
diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java
index bb6b3268092..8eec26821db 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/EagerShufflingTask.java
@@ -183,6 +183,12 @@ public class EagerShufflingTask extends AbstractPostRegistrationTaskForPhysicalD
     private List<Share> shares;
     private Date sharesTimestamp;
 
+    @Override
+    public void clearCache()
+    {
+        sharesTimestamp = null;
+    }
+
     @Override
     public IPostRegistrationTaskExecutor createExecutor(String dataSetCode)
     {
diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java
index 628eeb9f9a1..c6a81853f5d 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/IPostRegistrationTask.java
@@ -29,6 +29,11 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService;
  */
 public interface IPostRegistrationTask
 {
+    /**
+     * Clear potential cache.
+     */
+    public void clearCache();
+    
     /**
      * Returns <code>true</code> if this task needs a lock onto the data store.
      */
diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java
index 6f1a5229bfb..e346ec0cc27 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/postregistration/PostRegistrationMaintenanceTask.java
@@ -185,6 +185,7 @@ public class PostRegistrationMaintenanceTask implements IDataStoreLockingMainten
                 for (Entry<String, IPostRegistrationTask> entry : tasks)
                 {
                     IPostRegistrationTask task = entry.getValue();
+                    task.clearCache();
                     String taskName = entry.getKey();
                     executor.execute(task, taskName, code, dataSet.isContainer());
                 }
-- 
GitLab