fixed ckanutils creation
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129463 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7099328d5f
commit
a96155863b
|
@ -56,6 +56,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
public static final String CKAN_TOKEN_KEY = "ckanToken";
|
public static final String CKAN_TOKEN_KEY = "ckanToken";
|
||||||
|
|
||||||
|
private Object LOCK = new Object();
|
||||||
|
|
||||||
// library util instance
|
// library util instance
|
||||||
private CKanUtilsImpl instance;
|
private CKanUtilsImpl instance;
|
||||||
|
|
||||||
|
@ -66,13 +68,17 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
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