toJson(body));
}
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.createToscaNodeTemplates(body);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "POST /nodetemplates";
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}
toJson(body));
}
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.updateToscaNodeTemplates(body);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = "PUT /nodetemplates";
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}
@Override
public ResponseEntity<ToscaServiceTemplate> deleteToscaNodeTemplates(String name, String version, UUID requestId) {
try {
+ mutex.acquire();
ToscaServiceTemplate nodeTemplates = toscaServiceTemplateService.deleteToscaNodeTemplate(name, version);
return makeOkResponse(requestId, nodeTemplates);
} catch (PfModelException | PfModelRuntimeException pfme) {
final var msg = String.format("DELETE /nodetemplates/%s/versions/%s", name, version);
throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PolicyApiRuntimeException(e.getMessage(), null, null, requestId);
+ } finally {
+ mutex.release();
}
}