aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java')
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
index 1a94a531..8e13ced4 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
@@ -90,6 +90,28 @@ public class PolicyResourceLockManager extends SimpleLockManager {
}
@Override
+ public boolean refresh(String resourceId, String owner, int holdSec) {
+ if (resourceId == null) {
+ throw makeNullArgException(MSG_NULL_RESOURCE_ID);
+ }
+
+ if (owner == null) {
+ throw makeNullArgException(MSG_NULL_OWNER);
+ }
+
+
+ return doBoolIntercept(impl -> impl.beforeRefresh(resourceId, owner, holdSec), () -> {
+
+ // implementer didn't do the work - defer to the superclass
+ boolean refreshed = super.refresh(resourceId, owner, holdSec);
+
+ doIntercept(false, impl -> impl.afterRefresh(resourceId, owner, refreshed));
+
+ return refreshed;
+ });
+ }
+
+ @Override
public boolean unlock(String resourceId, String owner) {
if (resourceId == null) {
throw makeNullArgException(MSG_NULL_RESOURCE_ID);