public static OrderedServiceImpl<PolicyResourceLockFeatureAPI> impl =
new OrderedServiceImpl<>(PolicyResourceLockFeatureAPI.class);
- /**
- * Callback that an implementer invokes, asynchronously, when a lock is acquired (or
- * denied). The implementer invokes the method to indicate that the lock was acquired
- * (or denied).
- */
- @FunctionalInterface
- public static interface Callback {
-
- /**
- *
- * @param locked {@code true} if the lock was acquired, {@code false} if the lock
- * was denied
- */
- public void set(boolean locked);
- }
-
/**
*
* Result of a requested operation.
package org.onap.policy.drools.core.lock;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.function.Supplier;
-import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.Callback;
import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
protected static void setFactory(Factory factory) {
PolicyResourceLockManager.factory = factory;
}
-
- /**
- * This method is here temporarily so-as not to break the drools-applications
- * build. It will be removed once drools-applications has been updated.
- * @param resourceId
- * @param owner
- * @param callback
- * @return nothing; always throws an exception
- * @throws UnsupportedOperationException
- */
- public Future<Boolean> lock(String resourceId, String owner, Callback callback) {
- throw new UnsupportedOperationException("lock with callback");
- }
@Override
public boolean lock(String resourceId, String owner, int holdSec) {