Skip to content

Commit

Permalink
Some fixes related to task state reporting/storing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Sep 28, 2015
1 parent a6b093a commit c634f1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Expand Up @@ -84,7 +84,7 @@ public TaskRunResult run(Task task) {
LoggingUtils.logException(LOGGER, "Couldn't execute script", e);
runResult.setRunResultStatus(TaskRunResult.TaskRunResultStatus.PERMANENT_ERROR);
} finally {
TaskHandlerUtil.storeAllStatistics(task);
TaskHandlerUtil.storeAllStatistics(task, true, false);
}

task.getResult().computeStatus();
Expand Down
Expand Up @@ -18,6 +18,7 @@

import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
Expand Down Expand Up @@ -80,7 +81,7 @@ public static void storeAllStatistics(Task task, boolean enableIterationStatisti
if (enableSynchronizationStatistics) {
storeSynchronizationInformation(task);
}
task.savePendingModifications(task.getResult());
task.savePendingModifications(new OperationResult(TaskHandlerUtil.class.getSimpleName()+".storeAllStatistics")); // TODO fixme
} catch (SchemaException|ObjectNotFoundException |ObjectAlreadyExistsException |RuntimeException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't store statistical information into task {}", e, task);
}
Expand Down
Expand Up @@ -550,7 +550,11 @@ private boolean recordCycleRunFinish(TaskRunResult runResult, TaskHandler handle
task.setLastRunFinishTimestamp(System.currentTimeMillis());
if (runResult.getOperationResult() != null) {
OperationResult taskResult = runResult.getOperationResult().clone();
taskResult.cleanupResult();
try {
taskResult.cleanupResult();
} catch (Throwable ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Problem with task result cleanup - continuing", ex);
}
task.setResult(taskResult);
}
task.setNode(null);
Expand Down

0 comments on commit c634f1c

Please sign in to comment.