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";
|
||||
|
||||
private Object LOCK = new Object();
|
||||
|
||||
// library util instance
|
||||
private CKanUtilsImpl instance;
|
||||
|
||||
|
@ -66,13 +68,17 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|||
private CKanUtilsImpl getCkanUtilsObj(){
|
||||
|
||||
if(instance == null){
|
||||
// retrieve ckan information
|
||||
try{
|
||||
String currentScope = ScopeProvider.instance.get();
|
||||
logger.debug("Scope is " + currentScope);
|
||||
instance = new CKanUtilsImpl(currentScope);
|
||||
}catch(Exception e){
|
||||
logger.error("Unable to retrieve ckan information", e);
|
||||
synchronized(LOCK){
|
||||
if(instance == null){
|
||||
// retrieve ckan information
|
||||
try{
|
||||
String currentScope = ScopeProvider.instance.get();
|
||||
logger.debug("Scope is " + currentScope);
|
||||
instance = new CKanUtilsImpl(currentScope);
|
||||
}catch(Exception e){
|
||||
logger.error("Unable to retrieve ckan information", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue