use of org.sonar.db.ce.DeleteIf in project sonarqube by SonarSource.
the class CeQueueImpl method remove.
protected void remove(DbSession dbSession, CeQueueDto queueDto, CeActivityDto activityDto) {
String taskUuid = queueDto.getUuid();
CeQueueDto.Status expectedQueueDtoStatus = queueDto.getStatus();
dbClient.ceActivityDao().insert(dbSession, activityDto);
dbClient.ceTaskInputDao().deleteByUuids(dbSession, singleton(taskUuid));
int deletedTasks = dbClient.ceQueueDao().deleteByUuid(dbSession, taskUuid, new DeleteIf(expectedQueueDtoStatus));
if (deletedTasks == 1) {
dbSession.commit();
} else {
Loggers.get(CeQueueImpl.class).debug("Remove rolled back because task in queue with uuid {} and status {} could not be deleted", taskUuid, expectedQueueDtoStatus);
dbSession.rollback();
}
}
Aggregations