Skip to content
Snippets Groups Projects
Commit f9f16ae7 authored by srosse's avatar srosse
Browse files

OO-320: add a giant lock on load/save operation in ScoDocument

parent ddc3324c
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,8 @@ import java.util.Vector;
import org.jdom.Document;
import org.jdom.Element;
import org.olat.core.logging.OLATRuntimeException;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.modules.scorm.ISettingsHandler;
import uk.ac.reload.jdom.XMLDocument;
......@@ -47,6 +49,8 @@ import uk.ac.reload.jdom.XMLDocument;
* @author Paul Sharples
*/
public class ScoDocument extends XMLDocument {
private OLog log = Tracing.createLoggerFor(ScoDocument.class);
// var used to flag if the sco was "failed"
private boolean isFailed = false;
......@@ -120,8 +124,10 @@ public class ScoDocument extends XMLDocument {
// Make sure its there
if (pathToNavFile.exists()) {
try {
super.loadDocument(pathToNavFile);
synchronized(ScoDocument.class) {
super.loadDocument(pathToNavFile);
}
Element root = getDocument().getRootElement();
// set these now, so they are easy to get to when we need them later.
......@@ -146,12 +152,29 @@ public class ScoDocument extends XMLDocument {
isFailed = false;
}
} catch (Exception ex) {
log.info("Error loading: " + pathToNavFile + " :: " + this);
throw new OLATRuntimeException(this.getClass(), "error: could not load sco model for " + scoID, ex);
}
} else {
throw new OLATRuntimeException(this.getClass(), "error: could not find sco model for " + scoID, null);
}
}
@Override
public void saveAsDocument(File file) throws IOException {
synchronized(ScoDocument.class) {
super.saveAsDocument(file);
}
}
@Override
public void saveDocument() throws IOException {
synchronized(ScoDocument.class) {
super.saveDocument();
}
}
/**
* getScoModel() - This method searches the CMI xml file that was created when
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment