class ProcessConflictPreventer {

    public synchronized void acquireLock(String mtaId, String namespace, String spaceId, String processId) {
        LOGGER.info(format(Messages.ACQUIRING_LOCK, processId, mtaId));

        validateNoConflictingOperationsExist(mtaId, namespace, spaceId);
        Operation currentOperation = getOperationByProcessId(processId);
        ImmutableOperation.Builder currentOperationWithAcquiredLock = ImmutableOperation.builder()
                                                                                        .from(currentOperation)
                                                                                        .mtaId(mtaId)
                                                                                        .hasAcquiredLock(true);
        if (StringUtils.isNotEmpty(namespace)) {
            currentOperationWithAcquiredLock.namespace(namespace);
        }

        operationService.update(currentOperation, currentOperationWithAcquiredLock.build());

        LOGGER.info(format(Messages.ACQUIRED_LOCK, processId, StepsUtil.getQualifiedMtaId(mtaId, namespace)));
    }

    public  ProcessConflictPreventer(OperationService operationService);

}