From c8e989f47dbd2cffc1a7eb5468c8a966a77775f8 Mon Sep 17 00:00:00 2001 From: AndreasBlaesius <41140683+AndreasBlaesius@users.noreply.github.com> Date: Thu, 24 Sep 2020 06:59:02 +0200 Subject: [PATCH] Update ObjectQueueExecutor.java This chang is to fix an issue with a catched exception that is caused by a failing database transaction (for example not explicitly committed objects that are in the state 'Autocommitted'). Currently the process queue is only creating an info log but it is obviously an error. Changed it to error. Using the existing context for the setErrormessageAndCommit method is causing the changes made by his action to be rolled back with the entire transaction. I created a new system context to run this action. If you don't do that, the QueuedAction will remain in running forever, even if it is already terminated. --- .../processqueue/queuehandler/ObjectQueueExecutor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/javasource/processqueue/queuehandler/ObjectQueueExecutor.java b/javasource/processqueue/queuehandler/ObjectQueueExecutor.java index 2b01717..199fb87 100644 --- a/javasource/processqueue/queuehandler/ObjectQueueExecutor.java +++ b/javasource/processqueue/queuehandler/ObjectQueueExecutor.java @@ -223,15 +223,15 @@ public synchronized void run() this._state = State.finishedFollowup; } } catch (Exception e) { - _logNode.info("Error during commit from queue", e); - setErrormessageAndCommit(this.context, this.action, "An unknown error occured. Please contact your system administrator.", e, LogExecutionStatus.FailedExecuted, ActionStatus.Cancelled); + _logNode.error("Error during commit from queue", e); + setErrormessageAndCommit(Core.createSystemContext(), this.action, "An unknown error occured. Please contact your system administrator.", e, LogExecutionStatus.FailedExecuted, ActionStatus.Cancelled); } } } catch (Exception e) { this._state = State.failed; // Microflow is being rollbacked _logNode.error("Error during committing errormessage from queue", e); - setErrormessageAndCommit(this.context, this.action, "An unknown error occured. Please contact your system administrator.", e, LogExecutionStatus.FailedExecuted, ActionStatus.Cancelled); + setErrormessageAndCommit(Core.createSystemContext(), this.action, "An unknown error occured. Please contact your system administrator.", e, LogExecutionStatus.FailedExecuted, ActionStatus.Cancelled); } finally { this._state = State.threadFinished; @@ -309,4 +309,4 @@ public long getActionNr() { public String getMicroflowName() { return this.microflowName; } -} \ No newline at end of file +}