Search in sources :

Example 1 with DeleteIf

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();
    }
}
Also used : CeQueueDto(org.sonar.db.ce.CeQueueDto) DeleteIf(org.sonar.db.ce.DeleteIf)

Aggregations

CeQueueDto (org.sonar.db.ce.CeQueueDto)1 DeleteIf (org.sonar.db.ce.DeleteIf)1