X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FLock.java;h=a19870be75fa16be3060eeae5d9745cf8b4c3526;hb=bd30ef4a1c87d27491bcbf8b60bd6627bec85a48;hp=9f02f089f13df82cc3e23024277febf084c6a314;hpb=be2000ec2d21151b42cb559ef881695eb32e35e9;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java index 9f02f089..a19870be 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/Lock.java @@ -117,7 +117,7 @@ public class Lock { synchronized (this) { if (lockCounter <= 0) { lockCounter = -1; // Might as well stop, to make it easier to find the problem - throw new NullPointerException("Number of unlocks must match the number of locks"); + logger.error("Number of unlocks must match the number of locks"); } this.lockCounter--; if (lockCounter == 0) { @@ -130,7 +130,8 @@ public class Lock { @Override public String toString() { - return "Lock cnt: " + this.lockCounter + " exclusive: " + this.isExclusive; + return "Lock cnt: " + this.lockCounter + " exclusive: " + this.isExclusive + " queued: " + + this.lockRequestQueue.size(); } /** returns the current number of granted locks */ @@ -166,6 +167,7 @@ public class Lock { private synchronized void addToQueue(MonoSink callback, LockType lockType) { lockRequestQueue.add(new LockRequest(callback, lockType, this)); + processQueuedEntries(); } @SuppressWarnings("java:S2274") // Always invoke wait() and await() methods inside a loop