aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java')
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java37
1 files changed, 9 insertions, 28 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java
index d4e7bee9..1184b017 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java
@@ -20,7 +20,6 @@
package org.onap.policy.drools.core.lock;
-import java.util.concurrent.Future;
import org.onap.policy.drools.utils.OrderedService;
import org.onap.policy.drools.utils.OrderedServiceImpl;
@@ -62,6 +61,7 @@ public interface PolicyResourceLockFeatureAPI extends OrderedService {
}
/**
+ *
* Result of a requested operation.
*/
public enum OperResult {
@@ -87,40 +87,21 @@ public interface PolicyResourceLockFeatureAPI extends OrderedService {
}
/**
- * This method is called before a lock is acquired on a resource. If a callback is
- * provided, and the implementer is unable to acquire the lock immediately, then the
- * implementer will invoke the callback once the lock is acquired. If the implementer
- * handled the request, then it will return a future, which may be in one of three
- * states:
- * <dl>
- * <dt>isDone()=true and get()=true</dt>
- * <dd>the lock has been acquired; the callback may or may not have been invoked</dd>
- * <dt>isDone()=true and get()=false</dt>
- * <dd>the lock request has been denied; the callback may or may not have been
- * invoked</dd>
- * <dt>isDone()=false</dt>
- * <dd>the lock was not immediately available and a callback was provided. The
- * callback will be invoked once the lock is acquired (or denied). In this case, the
- * future may be used to cancel the request</dd>
- * </dl>
+ * This method is called before a lock is acquired on a resource. It may be
+ * invoked repeatedly to extend the time that a lock is held.
*
* @param resourceId
* @param owner
- * @param callback function to invoke, if the requester wishes to wait for the lock to
- * come available, {@code null} to provide immediate replies
- * @return a future for the lock, if the implementer handled the request, {@code null}
- * if additional locking logic should be performed
- * @throws IllegalStateException if the owner already holds the lock or is already in
- * the queue to get the lock
+ * @param holdSec the amount of time, in seconds, that the lock should be held
+ * @return the result, where <b>OPER_DENIED</b> indicates that the lock is currently
+ * held by another owner
*/
- public default Future<Boolean> beforeLock(String resourceId, String owner, Callback callback) {
- return null;
+ public default OperResult beforeLock(String resourceId, String owner, int holdSec) {
+ return OperResult.OPER_UNHANDLED;
}
/**
- * This method is called after a lock for a resource has been acquired or denied. This
- * may be invoked immediately, if the status can be determined immediately, or it may
- * be invoked asynchronously, once the status has been determined.
+ * This method is called after a lock for a resource has been acquired or denied.
*
* @param resourceId
* @param owner