Commit 204c54af authored by Piotr Gawron's avatar Piotr Gawron
Browse files

there was a problem with marking projects as failure on minerva startup

parent 0df2497d
......@@ -17,6 +17,7 @@ import lcsb.mapviewer.common.IProgressUpdater;
import lcsb.mapviewer.model.*;
import lcsb.mapviewer.model.map.layout.ReferenceGenome;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.persist.DbUtils;
import lcsb.mapviewer.services.interfaces.*;
/**
......@@ -26,22 +27,25 @@ import lcsb.mapviewer.services.interfaces.*;
@Component
public class StartupBean {
private final transient Logger logger = LogManager.getLogger(StartupBean.class);
private final transient Logger logger = LogManager.getLogger();
private transient IProjectService projectService;
private transient IConfigurationService configurationService;
private transient IReferenceGenomeService referenceGenomeService;
private transient DbUtils dbUtils;
private ServletContext servletContext;
@Autowired
public StartupBean(IProjectService projectService,
IConfigurationService configurationService,
IReferenceGenomeService referenceGenomeService,
ServletContext servletContext) {
ServletContext servletContext,
DbUtils dbUtils) {
this.projectService = projectService;
this.configurationService = configurationService;
this.referenceGenomeService = referenceGenomeService;
this.servletContext = servletContext;
this.dbUtils = dbUtils;
}
/**
......@@ -133,6 +137,7 @@ public class StartupBean {
*/
private void setInterruptedProjectsStatuses() {
try {
dbUtils.createSessionForCurrentThread();
for (Project project : projectService.getAllProjects()) {
if (!ProjectStatus.DONE.equals(project.getStatus()) && !ProjectStatus.FAIL.equals(project.getStatus())) {
ProjectLogEntry entry = new ProjectLogEntry();
......@@ -146,6 +151,7 @@ public class StartupBean {
logger.info("Status of project: " + project.getProjectId() + " changed to fail.");
}
}
dbUtils.closeSessionForCurrentThread();
} catch (Exception e) {
logger.error("Problem with changing project status ...", e);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment