added another cache for VRE catalogue folder
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@140059 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ceca8a5497
commit
bf3d0675ce
|
@ -27,6 +27,8 @@ import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
|||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.StockRecord;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.CSVHelpers;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.cache.CacheImpl;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.cache.CacheInterface;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.DataCatalogue;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -48,6 +50,8 @@ public class ManageTimeSeriesThread extends Thread{
|
|||
// try to attach the source at most CANCHES times ..
|
||||
private static final int CANCHES = 3;
|
||||
|
||||
private static CacheInterface<String, WorkspaceCatalogue> vreFolderCache = new CacheImpl<String, WorkspaceCatalogue>(1000 * 60 * 30);
|
||||
|
||||
private Common record;
|
||||
private String packageName;
|
||||
private String username;
|
||||
|
@ -129,9 +133,15 @@ public class ManageTimeSeriesThread extends Thread{
|
|||
if(record == null)
|
||||
throw new IllegalArgumentException("The given record is null!!");
|
||||
|
||||
String token = SecurityTokenProvider.instance.get();
|
||||
|
||||
WorkspaceCatalogue catalogueFolder = null;
|
||||
if((catalogueFolder = vreFolderCache.get(token)) == null){
|
||||
Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome().getWorkspace();
|
||||
WorkspaceSharedFolder vreFolder = ws.getVREFolderByScope(ScopeProvider.instance.get());
|
||||
WorkspaceCatalogue catalogueFolder = vreFolder.getVRECatalogue();
|
||||
catalogueFolder = vreFolder.getVRECatalogue();
|
||||
vreFolderCache.insert(token, catalogueFolder);
|
||||
}
|
||||
|
||||
logger.debug("Catalogue folder in vre has path " + catalogueFolder.getPath());
|
||||
|
||||
|
|
Loading…
Reference in New Issue