VIVO-67 Fix for the broken pull request
As described in the comments on https://github.com/vivo-project/VIVO/pull/3
This commit is contained in:
parent
9ada4eb84f
commit
5874b685cf
2 changed files with 9 additions and 16 deletions
|
@ -32,10 +32,11 @@ public class OrganizationToPublicationsForSubOrganizationsFactory implements
|
||||||
return candidateModel;
|
return candidateModel;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Lock customLock = CustomLock.getInstance().getLock();
|
Lock customLock = CustomLock.getLock();
|
||||||
if (customLock.tryLock()) //Acquiring lock if available to construct the model
|
if (customLock.tryLock()) //Acquiring lock if available to construct the model
|
||||||
{
|
{
|
||||||
customLock.lock();
|
try
|
||||||
|
{
|
||||||
ModelConstructor model = new OrganizationToPublicationsForSubOrganizationsModelConstructor(uri, dataset);
|
ModelConstructor model = new OrganizationToPublicationsForSubOrganizationsModelConstructor(uri, dataset);
|
||||||
|
|
||||||
Model constructedModel = model.getConstructedModel();
|
Model constructedModel = model.getConstructedModel();
|
||||||
|
@ -45,8 +46,10 @@ public class OrganizationToPublicationsForSubOrganizationsFactory implements
|
||||||
uri,
|
uri,
|
||||||
OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE),
|
OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE),
|
||||||
constructedModel);
|
constructedModel);
|
||||||
customLock.unlock();
|
|
||||||
return constructedModel;
|
return constructedModel;
|
||||||
|
} finally {
|
||||||
|
customLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
@ -8,19 +9,8 @@ import java.util.concurrent.locks.Lock;
|
||||||
construction of the models to resolve concurrency issue*/
|
construction of the models to resolve concurrency issue*/
|
||||||
|
|
||||||
public final class CustomLock{
|
public final class CustomLock{
|
||||||
private static final CustomLock instance = new CustomLock();
|
private static final Lock lock = new ReentrantLock();
|
||||||
private static Lock lock;
|
|
||||||
private CustomLock()
|
|
||||||
{
|
|
||||||
this.lock = new ReentrantLock();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CustomLock getInstance()
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Lock getLock()
|
public static Lock getLock()
|
||||||
{
|
{
|
||||||
return lock;
|
return lock;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue