diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-02-08 11:26:25 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-02-08 11:26:25 +0100 |
commit | 89f9555b858152f7e565504613485d5f37bff6f8 (patch) | |
tree | accbf89bb3fdfbf744bfaf6cf192a2acf97092cb | |
parent | d8c6190f7d4a71fac6a2cf08f3d6c956491fd8f5 (diff) |
Fix locking in InMemoryStatusService
-rw-r--r-- | orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/InMemoryStatusService.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/InMemoryStatusService.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/InMemoryStatusService.java index 70128ae12eb..41044bae782 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/InMemoryStatusService.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/InMemoryStatusService.java @@ -48,8 +48,7 @@ public class InMemoryStatusService implements StatusService { public MutableStatusRegistry lockApplicationInstance_forCurrentThreadOnly( OrchestratorContext context, ApplicationInstanceReference applicationInstanceReference) { - Lock lock = instanceLockService.get(applicationInstanceReference); - return new InMemoryMutableStatusRegistry(lock, applicationInstanceReference); + return new InMemoryMutableStatusRegistry(applicationInstanceReference); } @Override @@ -62,9 +61,11 @@ public class InMemoryStatusService implements StatusService { private final Lock lockHandle; private final ApplicationInstanceReference ref; - public InMemoryMutableStatusRegistry(Lock lockHandle, ApplicationInstanceReference ref) { - this.lockHandle = lockHandle; + private InMemoryMutableStatusRegistry(ApplicationInstanceReference ref) { this.ref = ref; + + this.lockHandle = instanceLockService.get(ref); + this.lockHandle.lock(); } @Override @@ -94,7 +95,7 @@ public class InMemoryStatusService implements StatusService { @Override public void close() { - //lockHandle.unlock(); TODO this casues illeal state monitor exception - how to use it properly + lockHandle.unlock(); } } |