fixed ckanutils creation
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129464 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ee5218ad24
commit
d04b8adc20
|
@ -64,6 +64,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
|
|
||||||
// ckan utils methods
|
// ckan utils methods
|
||||||
private CKanUtilsImpl instance;
|
private CKanUtilsImpl instance;
|
||||||
|
private Object LOCK = new Object();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since it needs the scope, we need to check if it is null or not
|
* Since it needs the scope, we need to check if it is null or not
|
||||||
|
@ -72,13 +73,17 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
||||||
private CKanUtilsImpl getCkanUtilsObj(){
|
private CKanUtilsImpl getCkanUtilsObj(){
|
||||||
|
|
||||||
if(instance == null){
|
if(instance == null){
|
||||||
// retrieve ckan information
|
synchronized(LOCK){
|
||||||
try{
|
if(instance == null){
|
||||||
String currentScope = ScopeProvider.instance.get();
|
// retrieve ckan information
|
||||||
logger.debug("Scope is " + currentScope);
|
try{
|
||||||
instance = new CKanUtilsImpl(currentScope);
|
String currentScope = ScopeProvider.instance.get();
|
||||||
}catch(Exception e){
|
logger.debug("Scope is " + currentScope);
|
||||||
logger.error("Unable to retrieve ckan information", e);
|
instance = new CKanUtilsImpl(currentScope);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Unable to retrieve ckan information", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue