diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java index 4a113af112..e8dadddcd1 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/SimpleHistoryServiceImpl.java @@ -42,7 +42,6 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory { private InternalTaskanaEngine internalTaskanaEngine; public void initialize(TaskanaEngine taskanaEngine) { - LOGGER.info( "Simple history service implementation initialized with schemaName: {} ", taskanaEngine.getConfiguration().getSchemaName()); @@ -153,16 +152,19 @@ public void create(ClassificationHistoryEvent event) { public void deleteHistoryEventsByTaskIds(List taskIds) throws InvalidArgumentException, NotAuthorizedException { - internalTaskanaEngine.openConnection(); internalTaskanaEngine.getEngine().checkRoleMembership(TaskanaRole.ADMIN); if (taskIds == null) { throw new InvalidArgumentException("List of taskIds must not be null."); } - taskHistoryEventMapper.deleteMultipleByTaskIds(taskIds); + try { + internalTaskanaEngine.openConnection(); + taskHistoryEventMapper.deleteMultipleByTaskIds(taskIds); + } finally { - internalTaskanaEngine.returnConnection(); + internalTaskanaEngine.returnConnection(); + } } public TaskHistoryEvent getTaskHistoryEvent(String historyEventId) diff --git a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java index a426cc7588..2f7a5f0adc 100644 --- a/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java +++ b/history/taskana-simplehistory-provider/src/main/java/pro/taskana/simplehistory/impl/jobs/HistoryCleanupJob.java @@ -46,10 +46,8 @@ public HistoryCleanupJob( TaskanaTransactionProvider txProvider, ScheduledJob scheduledJob) { super(taskanaEngine, txProvider, scheduledJob, true); - if (simpleHistoryService == null) { - simpleHistoryService = new SimpleHistoryServiceImpl(); - simpleHistoryService.initialize(taskanaEngine); - } + simpleHistoryService = new SimpleHistoryServiceImpl(); + simpleHistoryService.initialize(taskanaEngine); } public static Duration getLockExpirationPeriod(TaskanaConfiguration taskanaConfiguration) { diff --git a/history/taskana-simplehistory-provider/src/test/java/acceptance/events/classification/CreateHistoryEventOnClassificationDeletionAccTest.java b/history/taskana-simplehistory-provider/src/test/java/acceptance/events/classification/CreateHistoryEventOnClassificationDeletionAccTest.java index d30c1438e7..1bc95daf1c 100644 --- a/history/taskana-simplehistory-provider/src/test/java/acceptance/events/classification/CreateHistoryEventOnClassificationDeletionAccTest.java +++ b/history/taskana-simplehistory-provider/src/test/java/acceptance/events/classification/CreateHistoryEventOnClassificationDeletionAccTest.java @@ -30,9 +30,6 @@ void should_CreateClassificationDeletedHistoryEvent_When_ClassificationIsDeleted final String classificationId = "CLI:200000000000000000000000000000000015"; - taskService.createTaskQuery().list(); - historyService.deleteHistoryEventsByTaskIds(List.of("test12")); - List events = historyService .createClassificationHistoryQuery()