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:
Costantino Perciante 2016-06-27 09:55:06 +00:00
parent 7099328d5f
commit a96155863b
1 changed files with 15 additions and 9 deletions

View File

@ -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;
@ -65,6 +67,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
*/
private CKanUtilsImpl getCkanUtilsObj(){
if(instance == null){
synchronized(LOCK){
if(instance == null){
// retrieve ckan information
try{
@ -75,6 +79,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
logger.error("Unable to retrieve ckan information", e);
}
}
}
}
return instance;
}