aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/guard/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/guard/src/main')
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java20
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java2
2 files changed, 13 insertions, 9 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
index e9ff01072..e4fd27415 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
@@ -64,6 +64,8 @@ public class PolicyGuard {
}
/**
+ * Get the factory.
+ *
* @return the factory used to access various objects
*/
protected static Factory getFactory() {
@@ -72,7 +74,7 @@ public class PolicyGuard {
/**
* Sets the factory to be used by junit tests.
- * @param factory
+ * @param factory factory
*/
protected static void setFactory(Factory factory) {
PolicyGuard.factory = factory;
@@ -95,7 +97,7 @@ public class PolicyGuard {
String owner = makeOwner(targetType, requestID);
boolean result = factory.getManager().lock(targetInstance, owner, holdSec);
- if(!result) {
+ if (!result) {
return LockResult.createLockResult(GuardResult.LOCK_DENIED, null);
}
@@ -145,7 +147,7 @@ public class PolicyGuard {
boolean result = factory.getManager().refresh(lock.getTargetInstance(), owner, holdSec);
logger.debug("Lock {} extend {}", lock, result);
- return(result ? GuardResult.LOCK_ACQUIRED : GuardResult.LOCK_DENIED);
+ return (result ? GuardResult.LOCK_ACQUIRED : GuardResult.LOCK_DENIED);
}
/**
@@ -160,7 +162,7 @@ public class PolicyGuard {
String owner = makeOwner(lock.getTargetType(), lock.getRequestID());
boolean result = factory.getManager().unlock(lock.getTargetInstance(), owner);
- if(result) {
+ if (result) {
logger.debug("Unlocked {}", lock);
return true;
}
@@ -184,17 +186,17 @@ public class PolicyGuard {
/**
* Combines the target type and request ID to yield a single, "owner" string.
- * @param targetType
- * @param requestID
+ * @param targetType target type
+ * @param requestID request id
* @return the "owner" of a resource
* @throws IllegalArgumentException if either argument is null
*/
private static String makeOwner(TargetType targetType, UUID requestID) {
- if(targetType == null) {
+ if (targetType == null) {
throw new IllegalArgumentException("null targetType for lock request id " + requestID);
}
- if(requestID == null) {
+ if (requestID == null) {
throw new IllegalArgumentException("null requestID for lock type " + targetType);
}
@@ -207,6 +209,8 @@ public class PolicyGuard {
public static class Factory {
/**
+ * Get the manager.
+ *
* @return the lock manager to be used
*/
public PolicyResourceLockManager getManager() {
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
index 233fc0b49..46a815cdd 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/Util.java
@@ -135,7 +135,7 @@ public final class Util {
/**
* Sets Guard Properties.
*
- * @see /guard/src/test/java/org/onap/policy/guard/UtilTest.java for setting test properties
+ * <p>see /guard/src/test/java/org/onap/policy/guard/UtilTest.java for setting test properties
*/
public static void setGuardEnvProps(String url, String username, String password, String clientName,
String clientPassword, String environment) {