summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2021-02-21 16:00:25 +0100
committerGitHub <noreply@github.com>2021-02-21 16:00:25 +0100
commit8144fb581207999bf76e11a817e7cd0c7f10a0dd (patch)
tree6aab1bbd45b5d0770f31cf26a62c1faa37a222aa
parent3e398eaf1db5847602f54cac33bf3c76718631fa (diff)
parent5d2d0f18056e49e7274f1482dccc5fb49e85d086 (diff)
Merge pull request #16613 from vespa-engine/bratseth/lock-first
Lock first
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
index 4e89d839a6a..035141356b9 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/ApplicationPatcher.java
@@ -33,8 +33,14 @@ public class ApplicationPatcher implements AutoCloseable {
} catch (IOException e) {
throw new UncheckedIOException("Error reading request body", e);
}
- this.application = nodeRepository.applications().require(applicationId);
this.lock = nodeRepository.nodes().lock(applicationId);
+ try {
+ this.application = nodeRepository.applications().require(applicationId);
+ }
+ catch (RuntimeException e) {
+ lock.close();
+ throw e;
+ }
}
/** Applies the json to the application and returns it. */