Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,27 @@ protected void persistSaga(final Step step, final Object sagaIdentifier, final S
}

protected void persistSaga(final Object sagaIdentifier, final Saga saga, final boolean endSaga) {
long startTime = System.nanoTime();
if (endSaga) {
Timer.Context endTimer = KasperMetrics.getMetricRegistry().timer(KasperMetrics.name(saga.getClass(), "end-handle-time")).time();
try {
repository.delete(saga.getClass(), sagaIdentifier);

for (final Step aStep : steps.values()) {
Timer.Context endTimerSteps = KasperMetrics.getMetricRegistry().timer(KasperMetrics.name(saga.getClass(), saga.getClass().getSimpleName() + "." + aStep.name() + ".end-handle-time")).time();
aStep.clean(sagaIdentifier);
endTimerSteps.stop();
}
} catch (Exception e) {
throw new SagaExecutionException(
String.format("Unexpected error in deleting saga, <saga=%s> <identifier=%s>", saga.getClass(), sagaIdentifier),
e
);
} finally {
long endTime = System.nanoTime();
LOGGER.info(String.format("[SagaExecutor][End] Process time %d ms", (endTime - startTime)/1000000));
endTimer.stop();
}
}

} else {
try {
Expand All @@ -231,6 +236,9 @@ protected void persistSaga(final Object sagaIdentifier, final Saga saga, final b
String.format("Unexpected error in saving saga, <saga=%s> <identifier=%s>", saga.getClass(), sagaIdentifier),
e
);
}finally {
long endTime = System.nanoTime();
LOGGER.info(String.format("[SagaExecutor][Save] Process time %d ms", (endTime - startTime)/1000000));
}
}
}
Expand Down