Search in sources :

Example 1 with LoadProjectResult

use of edu.stanford.bmir.protege.web.shared.project.LoadProjectResult in project webprotege by protegeproject.

the class LoadProjectActionHandler method execute.

@Nonnull
@Override
public LoadProjectResult execute(@Nonnull final LoadProjectAction action, @Nonnull ExecutionContext executionContext) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    logger.info("{} is being loaded due to request by {}", action.getProjectId(), executionContext.getUserId());
    projectManager.getProject(action.getProjectId(), executionContext.getUserId());
    stopwatch.stop();
    logger.info("{} was loaded in {} ms due to request by {}", action.getProjectId(), stopwatch.elapsed(TimeUnit.MILLISECONDS), executionContext.getUserId());
    MemoryMonitor memoryMonitor = new MemoryMonitor(logger);
    memoryMonitor.monitorMemoryUsage();
    memoryMonitor.logMemoryUsage();
    final ProjectId projectId = action.getProjectId();
    ProjectDetails projectDetails = projectDetailsManager.getProjectDetails(projectId);
    if (!executionContext.getUserId().isGuest()) {
        userActivityManager.addRecentProject(executionContext.getUserId(), action.getProjectId(), System.currentTimeMillis());
    }
    return new LoadProjectResult(action.getProjectId(), executionContext.getUserId(), projectDetails);
}
Also used : MemoryMonitor(edu.stanford.bmir.protege.web.server.util.MemoryMonitor) ProjectDetails(edu.stanford.bmir.protege.web.shared.project.ProjectDetails) Stopwatch(com.google.common.base.Stopwatch) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) LoadProjectResult(edu.stanford.bmir.protege.web.shared.project.LoadProjectResult) Nonnull(javax.annotation.Nonnull)

Aggregations

Stopwatch (com.google.common.base.Stopwatch)1 MemoryMonitor (edu.stanford.bmir.protege.web.server.util.MemoryMonitor)1 LoadProjectResult (edu.stanford.bmir.protege.web.shared.project.LoadProjectResult)1 ProjectDetails (edu.stanford.bmir.protege.web.shared.project.ProjectDetails)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 Nonnull (javax.annotation.Nonnull)1