aboutsummaryrefslogtreecommitdiffstats
path: root/feature-server-pool
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-19 14:32:10 -0400
committerJim Hahn <jrh3@att.com>2020-06-19 15:44:28 -0400
commit56a15039437ba5bf5d0fb422551bfb12e1f59eb1 (patch)
tree1fc57df4d9462790d4c4dd811425ab029d8ec710 /feature-server-pool
parent1d810e0be1188c07ec9292b348c9d286f36963d9 (diff)
Address checkstyle version issues in drools-pdp
Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-server-pool')
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Bucket.java51
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Discovery.java3
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/FeatureServerPool.java39
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Keyword.java22
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Leader.java2
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/MainLoop.java1
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java3
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java20
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java1
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolProperties.java1
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java91
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Util.java1
-rw-r--r--feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/persistence/Persistence.java34
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java6
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java1
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java1
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java6
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java4
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java2
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java10
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java17
-rw-r--r--feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java4
22 files changed, 162 insertions, 158 deletions
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Bucket.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Bucket.java
index b949134f..bf3af4a8 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Bucket.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Bucket.java
@@ -62,12 +62,10 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import lombok.Getter;
import lombok.Setter;
import org.slf4j.Logger;
@@ -142,7 +140,7 @@ public class Bucket {
static {
// create hash bucket entries, but there are no assignments yet
- for (int i = 0 ; i < indexToBucket.length ; i += 1) {
+ for (int i = 0; i < indexToBucket.length; i += 1) {
Bucket bucket = new Bucket(i);
indexToBucket[i] = bucket;
}
@@ -756,8 +754,7 @@ public class Bucket {
* current host.
*/
UUID key = oldHost.uuid;
- for (int count = new Random().nextInt(rb.testServers.size() - 1) ;
- count >= 0 ; count -= 1) {
+ for (int count = new Random().nextInt(rb.testServers.size() - 1); count >= 0; count -= 1) {
key = rb.testServers.higherKey(key);
if (key == null) {
// wrap to the beginning of the list
@@ -1379,9 +1376,9 @@ public class Bucket {
}
}
- /********************************************/
- /* Comparable<AdjustedTestServer> interface */
- /********************************************/
+ /* ****************************************** */
+ /* Comparable<AdjustedTestServer> interface */
+ /* ****************************************** */
/**
* {@inheritDoc}
@@ -1421,7 +1418,7 @@ public class Bucket {
TestBucket[] buckets = new TestBucket[indexToBucket.length];
// this table resembles the 'Server.servers' table
- TreeMap<UUID,TestServer> testServers = new TreeMap<>(Util.uuidComparator);
+ TreeMap<UUID, TestServer> testServers = new TreeMap<>(Util.uuidComparator);
/* this is a special server instance, which is allocated any
* owned, primary, or secondary buckets that haven't been allocated to
@@ -1448,7 +1445,7 @@ public class Bucket {
*/
Callable<Integer> callable = () -> {
// copy the 'Bucket' table
- for (int i = 0 ; i < indexToBucket.length; i += 1) {
+ for (int i = 0; i < indexToBucket.length; i += 1) {
// makes a snapshot of the bucket information
Bucket bucket = indexToBucket[i];
@@ -1619,7 +1616,7 @@ public class Bucket {
if (primaryBackup != null
&& !Objects.equals(siteSocketAddress,
primaryBackup.siteSocketAddress)) {
- /**
+ /*
* primary backup is from the wrong site -- see if we can
* use the secondary.
*/
@@ -1769,7 +1766,7 @@ public class Bucket {
DataOutputStream dos = new DataOutputStream(bos);
// go through the entire 'buckets' table
- for (int i = 0 ; i < buckets.length ; i += 1) {
+ for (int i = 0; i < buckets.length; i += 1) {
// fetch the 'TestBucket' associated with index 'i'
TestBucket testBucket = buckets[i];
@@ -1831,7 +1828,7 @@ public class Bucket {
final Entity<String> entity =
Entity.entity(new String(Base64.getEncoder().encode(packet),
StandardCharsets.UTF_8), MediaType.APPLICATION_OCTET_STREAM_TYPE);
- /**
+ /*
* This method is running within the 'MainLoop' thread.
*/
Runnable task = () -> {
@@ -2179,9 +2176,9 @@ public class Bucket {
}
}
- /*********************/
- /* 'State' interface */
- /*********************/
+ /* ******************* */
+ /* 'State' interface */
+ /* ******************* */
/**
* {@inheritDoc}
@@ -2232,9 +2229,9 @@ public class Bucket {
}
}
- /**********************/
- /* 'Thread' interface */
- /**********************/
+ /* ******************** */
+ /* 'Thread' interface */
+ /* ******************** */
/**
* {@inheritDoc}
@@ -2367,10 +2364,10 @@ public class Bucket {
*/
private void restoreBucketData(Object obj) {
if (obj instanceof List) {
- for (Object entry : (List<?>)obj) {
+ for (Object entry : (List<?>) obj) {
if (entry instanceof Restore) {
// entry-specific 'restore' operation
- ((Restore)entry).restore(Bucket.this.index);
+ ((Restore) entry).restore(Bucket.this.index);
} else {
logger.error("{}: Expected '{}' but got '{}'",
this, Restore.class.getName(),
@@ -2401,9 +2398,9 @@ public class Bucket {
start();
}
- /*********************/
- /* 'State' interface */
- /*********************/
+ /* ******************* */
+ /* 'State' interface */
+ /* ******************* */
/**
* {@inheritDoc}
@@ -2433,9 +2430,9 @@ public class Bucket {
logger.error("{}: 'bulkSerializedData()' shouldn't be called in this state", this);
}
- /**********************/
- /* 'Thread' interface */
- /**********************/
+ /* ******************** */
+ /* 'Thread' interface */
+ /* ******************** */
/**
* {@inheritDoc}
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Discovery.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Discovery.java
index 1d695a01..2d643a34 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Discovery.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Discovery.java
@@ -37,7 +37,6 @@ import static org.onap.policy.drools.serverpool.ServerPoolProperties.DISCOVER_PU
import static org.onap.policy.drools.serverpool.ServerPoolProperties.getProperty;
import com.google.gson.Gson;
-
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.nio.charset.StandardCharsets;
@@ -46,7 +45,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
@@ -55,7 +53,6 @@ import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/FeatureServerPool.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/FeatureServerPool.java
index dfe211ce..23da0712 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/FeatureServerPool.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/FeatureServerPool.java
@@ -41,14 +41,11 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import lombok.AllArgsConstructor;
-
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
@@ -126,7 +123,7 @@ public class FeatureServerPool
* table[0] = {"requestID"}
* table[1] = {"CommonHeader", "RequestID"}
*/
- private static HashMap<String,String[][]> topicToPaths = new HashMap<>();
+ private static HashMap<String, String[][]> topicToPaths = new HashMap<>();
// this table is used for any topics that aren't in 'topicToPaths'
private static String[][] defaultPaths = new String[0][];
@@ -144,9 +141,9 @@ public class FeatureServerPool
private static final String QP_PROTOCOL = "protocol";
private static final String QP_TOPIC = "topic";
- /******************************/
- /* 'OrderedService' interface */
- /******************************/
+ /* **************************** */
+ /* 'OrderedService' interface */
+ /* **************************** */
/**
* {@inheritDoc}
@@ -158,9 +155,9 @@ public class FeatureServerPool
return -1000000;
}
- /**************************************/
- /* 'PolicyEngineFeatureApi' interface */
- /**************************************/
+ /* ************************************ */
+ /* 'PolicyEngineFeatureApi' interface */
+ /* ************************************ */
/**
* {@inheritDoc}
@@ -270,9 +267,9 @@ public class FeatureServerPool
return true;
}
- /******************************************/
- /* 'PolicyControllerFeatureApi' interface */
- /******************************************/
+ /* **************************************** */
+ /* 'PolicyControllerFeatureApi' interface */
+ /* **************************************** */
/**
* This method is called from 'AggregatedPolicyController.onTopicEvent',
@@ -411,7 +408,7 @@ public class FeatureServerPool
* TBD: it would be nice to limit the number of hops, in case we
* somehow have a loop.
*/
- ((TopicListener)controller).onTopicEvent(
+ ((TopicListener) controller).onTopicEvent(
CommInfrastructure.valueOf(protocol), topic, event);
} else {
/*
@@ -573,7 +570,7 @@ public class FeatureServerPool
// Example: requestID,CommonHeader.RequestID
String[] commaSeparatedEntries = prop.getProperty(name).split(",");
String[][] paths = new String[commaSeparatedEntries.length][];
- for (int i = 0 ; i < commaSeparatedEntries.length ; i += 1) {
+ for (int i = 0; i < commaSeparatedEntries.length; i += 1) {
paths[i] = commaSeparatedEntries[i].split("\\.");
}
@@ -663,7 +660,7 @@ public class FeatureServerPool
* TBD: it would be nice to limit the number of hops, in case we
* somehow have a loop.
*/
- ((TopicListener)controller).onTopicEvent(protocol, topic, event);
+ ((TopicListener) controller).onTopicEvent(protocol, topic, event);
} else {
/*
* This 'PolicyController' was also a 'TopicListener' on the sender's
@@ -748,6 +745,8 @@ public class FeatureServerPool
* This class is used to generate and restore backup Drools data.
*/
static class DroolsSessionRestore implements Bucket.Restore, Serializable {
+ private static final long serialVersionUID = 1L;
+
// backup data for all Drools sessions on this host
private final List<SingleSession> sessions = new LinkedList<>();
@@ -801,7 +800,7 @@ public class FeatureServerPool
}
}
- /**
+ /*
* data copying can start as soon as we receive results
* from pending sessions (there may not be any)
*/
@@ -822,7 +821,7 @@ public class FeatureServerPool
PolicySession session = pair.second();
long delay = endTime - System.currentTimeMillis();
if (delay < 0) {
- /**
+ /*
* we have already reached the time limit, so we will
* only process data that has already been received
*/
@@ -892,6 +891,8 @@ public class FeatureServerPool
* been backed up, or is being restored.
*/
static class SingleSession implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// the group id associated with the Drools container
String groupId;
@@ -969,7 +970,7 @@ public class FeatureServerPool
Object obj = ois.readObject();
if (obj instanceof List) {
- final List<?> droolsObjects = (List<?>)obj;
+ final List<?> droolsObjects = (List<?>) obj;
logger.info("{}: session={}, got {} object(s)",
this, session.getFullName(), droolsObjects.size());
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Keyword.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Keyword.java
index e0b97fda..10210ebf 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Keyword.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Keyword.java
@@ -27,9 +27,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
-
import lombok.AllArgsConstructor;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -130,7 +128,7 @@ public class Keyword {
// this table maps class name to a sequence of method calls and field
// references, based upon 'keyword.<CLASS-NAME>.lookup' entries found
// in the property list
- private static Map<String,String> classNameToSequence = null;
+ private static Map<String, String> classNameToSequence = null;
static final String KEYWORD_PROPERTY_START = "keyword.";
static final String KEYWORD_PROPERTY_END = ".lookup";
@@ -186,7 +184,7 @@ public class Keyword {
*/
private static Class<?> buildReflectiveLookup_findKeyClass(Class<?> clazz) {
Class<?> keyClass = null;
- for (Class<?> cl = clazz ; cl != null ; cl = cl.getSuperclass()) {
+ for (Class<?> cl = clazz; cl != null; cl = cl.getSuperclass()) {
if (classNameToSequence.containsKey(cl.getName())) {
// matches the class
keyClass = cl;
@@ -218,7 +216,7 @@ public class Keyword {
// we found a matching key in the table -- now, process the values
Class<?> currentClass = keyClass;
- /**
+ /*
* there may potentially be a chain of entries if multiple
* field and/or method calls are in the sequence -- this is the first
*/
@@ -227,7 +225,7 @@ public class Keyword {
// this is the last entry in the list
ReflectiveLookup last = null;
- /**
+ /*
* split the value into segments, where each segment has the form
* 'FIELD-NAME' or 'METHOD-NAME()', with an optional ':CONVERSION'
* at the end
@@ -325,9 +323,9 @@ public class Keyword {
field = clazz.getField(segment);
}
- /********************************/
- /* 'ReflectiveLookup' interface */
- /********************************/
+ /* ****************************** */
+ /* 'ReflectiveLookup' interface */
+ /* ****************************** */
/**
* {@inheritDoc}
@@ -337,9 +335,9 @@ public class Keyword {
return field.getType();
}
- /**********************/
- /* 'Lookup' interface */
- /**********************/
+ /* ******************** */
+ /* 'Lookup' interface */
+ /* ******************** */
/**
* {@inheritDoc}
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Leader.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Leader.java
index 06b02527..cf535b43 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Leader.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Leader.java
@@ -38,10 +38,8 @@ import java.util.HashSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.UUID;
-
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/MainLoop.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/MainLoop.java
index 1c6281d9..4ae8b59b 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/MainLoop.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/MainLoop.java
@@ -27,7 +27,6 @@ import static org.onap.policy.drools.serverpool.ServerPoolProperties.getProperty
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.TimeUnit;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
index 8ece943e..636fa4d5 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/RestServerPool.java
@@ -25,13 +25,11 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Info;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -40,7 +38,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java
index ad0e25ee..511b79a7 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java
@@ -78,13 +78,11 @@ import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.glassfish.jersey.client.ClientProperties;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
@@ -306,13 +304,13 @@ public class Server implements Comparable<Server> {
possibleError = "HTTP server initialization error";
restServer = HttpServletServerFactoryInstance.getServerFactory().build(
- "SERVER-POOL", // name
- useHttps, // https
- socketAddress.getAddress().getHostAddress(),// host (maybe 0.0.0.0)
- port, // port (can no longer be 0)
- null, // contextPath
- false, // swagger
- false); // managed
+ "SERVER-POOL", // name
+ useHttps, // https
+ socketAddress.getAddress().getHostAddress(), // host (maybe 0.0.0.0)
+ port, // port (can no longer be 0)
+ null, // contextPath
+ false, // swagger
+ false); // managed
restServer.addServletClass(null, RestServerPool.class.getName());
// add any additional servlets
@@ -877,7 +875,7 @@ public class Server implements Comparable<Server> {
// TBD: We need a way to get this information without reflection
Field field = client.getClass().getDeclaredField("client");
field.setAccessible(true);
- Client rsClient = (Client)field.get(client);
+ Client rsClient = (Client) field.get(client);
field.setAccessible(false);
rsClient.property(ClientProperties.CONNECT_TIMEOUT, connectTimeout);
@@ -917,7 +915,7 @@ public class Server implements Comparable<Server> {
}
getThreadPool().execute(() -> {
- /**
+ /*
* This method is running within the 'MainLoop' thread.
*/
try {
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java
index c6337749..d267ce82 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolApi.java
@@ -21,7 +21,6 @@
package org.onap.policy.drools.serverpool;
import java.util.Collection;
-
import org.onap.policy.common.utils.services.OrderedService;
import org.onap.policy.common.utils.services.OrderedServiceImpl;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolProperties.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolProperties.java
index 61188e6b..d1c09d43 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolProperties.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/ServerPoolProperties.java
@@ -21,7 +21,6 @@
package org.onap.policy.drools.serverpool;
import java.util.Properties;
-
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
index b2e0fb29..dee03a1b 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/TargetLock.java
@@ -20,7 +20,6 @@
package org.onap.policy.drools.serverpool;
-import static org.junit.Assert.assertTrue;
import static org.onap.policy.drools.serverpool.ServerPoolProperties.DEFAULT_LOCK_AUDIT_GRACE_PERIOD;
import static org.onap.policy.drools.serverpool.ServerPoolProperties.DEFAULT_LOCK_AUDIT_PERIOD;
import static org.onap.policy.drools.serverpool.ServerPoolProperties.DEFAULT_LOCK_AUDIT_RETRY_DELAY;
@@ -58,9 +57,7 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import lombok.EqualsAndHashCode;
-import lombok.NonNull;
import org.onap.policy.drools.core.DroolsRunnable;
import org.onap.policy.drools.core.PolicyContainer;
import org.onap.policy.drools.core.PolicySession;
@@ -86,6 +83,8 @@ import org.slf4j.LoggerFactory;
* owned by the host containing the entry.
*/
public class TargetLock implements Lock, Serializable {
+ private static final long serialVersionUID = 1L;
+
private static Logger logger = LoggerFactory.getLogger(TargetLock.class);
// Listener class to handle state changes that require restarting the audit
@@ -234,7 +233,7 @@ public class TargetLock implements Lock, Serializable {
context = new PolicySessionContext(session);
session.setAdjunct(PolicySessionContext.class, context);
} else {
- context = (LockCallback)lcontext;
+ context = (LockCallback) lcontext;
}
} else {
// no context to deliver through -- call back directly to owner
@@ -325,7 +324,7 @@ public class TargetLock implements Lock, Serializable {
logger.info("Lock response={} (code={})",
response, response.getStatus());
- /**
+ /*
* there are three possible responses:
* 204 No Content - operation was successful
* 202 Accepted - operation is still in progress
@@ -362,9 +361,9 @@ public class TargetLock implements Lock, Serializable {
});
}
- /********************/
- /* 'Lock' Interface */
- /********************/
+ /* ****************** */
+ /* 'Lock' Interface */
+ /* ****************** */
/**
* This method will free the current lock, or remove it from the waiting
@@ -444,7 +443,7 @@ public class TargetLock implements Lock, Serializable {
// not implemented yet
}
- /********************/
+ /* ****************** */
/**
* Update the state.
@@ -690,9 +689,9 @@ public class TargetLock implements Lock, Serializable {
+ ", state=" + state + ")";
}
- /*****************/
- /* Serialization */
- /*****************/
+ /* *************** */
+ /* Serialization */
+ /* *************** */
/**
* This method modifies the behavior of 'TargetLock' deserialization by
@@ -715,9 +714,9 @@ public class TargetLock implements Lock, Serializable {
/* ============================================================ */
private static class LockFactory implements PolicyResourceLockManager {
- /*****************************************/
- /* 'PolicyResourceLockManager' interface */
- /*****************************************/
+ /* *************************************** */
+ /* 'PolicyResourceLockManager' interface */
+ /* *************************************** */
/**
* {@inheritDoc}
@@ -730,9 +729,9 @@ public class TargetLock implements Lock, Serializable {
return new TargetLock(resourceId, ownerKey, callback, waitForLock);
}
- /*************************/
- /* 'Startable' interface */
- /*************************/
+ /* *********************** */
+ /* 'Startable' interface */
+ /* *********************** */
/**
* {@inheritDoc}
@@ -766,9 +765,9 @@ public class TargetLock implements Lock, Serializable {
return true;
}
- /************************/
- /* 'Lockable' interface */
- /************************/
+ /* ********************** */
+ /* 'Lockable' interface */
+ /* ********************** */
/**
* {@inheritDoc}
@@ -835,6 +834,8 @@ public class TargetLock implements Lock, Serializable {
*/
@EqualsAndHashCode
private static class Identity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// this is the key associated with the lock
String key;
@@ -956,6 +957,8 @@ public class TargetLock implements Lock, Serializable {
* the callback to 'TargetLock.owner' runs within the Drools thread.
*/
private static class PolicySessionContext implements LockCallback, Serializable {
+ private static final long serialVersionUID = 1L;
+
// the 'PolicySession' instance in question
PolicySession policySession;
@@ -968,9 +971,9 @@ public class TargetLock implements Lock, Serializable {
this.policySession = policySession;
}
- /*********************/
- /* 'Owner' interface */
- /*********************/
+ /* ******************* */
+ /* 'Owner' interface */
+ /* ******************* */
/**
* {@inheritDoc}
@@ -980,7 +983,7 @@ public class TargetLock implements Lock, Serializable {
// Run 'owner.lockAvailable' within the Drools session
if (policySession != null) {
DroolsRunnable callback = () -> {
- ((TargetLock)lock).owner.lockAvailable(lock);
+ ((TargetLock) lock).owner.lockAvailable(lock);
};
policySession.getKieSession().insert(callback);
}
@@ -994,15 +997,15 @@ public class TargetLock implements Lock, Serializable {
// Run 'owner.unlockAvailable' within the Drools session
if (policySession != null) {
DroolsRunnable callback = () -> {
- ((TargetLock)lock).owner.lockUnavailable(lock);
+ ((TargetLock) lock).owner.lockUnavailable(lock);
};
policySession.getKieSession().insert(callback);
}
}
- /*****************/
- /* Serialization */
- /*****************/
+ /* *************** */
+ /* Serialization */
+ /* *************** */
/**
* Specializes serialization of 'PolicySessionContext'.
@@ -1080,6 +1083,8 @@ public class TargetLock implements Lock, Serializable {
* of the lock implementation.
*/
public static class GlobalLocks implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// this is the lock table, mapping 'key' to 'LockEntry', which indicates
// the current lock holder, and all those waiting
private Map<String, LockEntry> keyToEntry = new HashMap<>();
@@ -1206,6 +1211,8 @@ public class TargetLock implements Lock, Serializable {
* any that are waiting.
*/
private static class LockEntry implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// string key identifying the lock
private String key;
@@ -1290,6 +1297,8 @@ public class TargetLock implements Lock, Serializable {
* This corresponds to a member of 'LockEntry.waitingList'
*/
private static class Waiting implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// string key identifying the owner
String ownerKey;
@@ -1337,6 +1346,8 @@ public class TargetLock implements Lock, Serializable {
* This class is used to restore a 'GlobalLocks' instance from a backup.
*/
static class LockRestore implements Bucket.Restore, Serializable {
+ private static final long serialVersionUID = 1L;
+
GlobalLocks globalLocks;
/**
@@ -1400,7 +1411,7 @@ public class TargetLock implements Lock, Serializable {
// here. The alternative is to add some additional information
// to make this mapping quick, at the expense of a slight
// slow down of normal lock operations.
- for (int i = 0 ; i < Bucket.BUCKETCOUNT ; i += 1) {
+ for (int i = 0; i < Bucket.BUCKETCOUNT; i += 1) {
LocalLocks localLocks =
Bucket.getBucket(i).getAdjunctDontCreate(LocalLocks.class);
if (localLocks != null) {
@@ -1595,7 +1606,7 @@ public class TargetLock implements Lock, Serializable {
Object decodedData = Util.deserialize(Base64.getDecoder().decode(data));
if (decodedData instanceof HostData) {
// deserialized data
- HostData hostData = (HostData)decodedData;
+ HostData hostData = (HostData) decodedData;
// fetch 'Server' instance associated with the responding server
Server server = Server.getServer(hostData.hostUuid);
@@ -2020,6 +2031,8 @@ public class TargetLock implements Lock, Serializable {
* host that is consolidating the information for display.
*/
static class HostData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// the UUID of the host sending the data
private UUID hostUuid;
@@ -2042,7 +2055,7 @@ public class TargetLock implements Lock, Serializable {
serverDataList = new ArrayList<ServerData>();
// go through buckets
- for (int i = 0 ; i < Bucket.BUCKETCOUNT ; i += 1) {
+ for (int i = 0; i < Bucket.BUCKETCOUNT; i += 1) {
Bucket bucket = Bucket.getBucket(i);
// client data
@@ -2089,6 +2102,8 @@ public class TargetLock implements Lock, Serializable {
* Information derived from the 'LocalLocks' adjunct to a single bucket.
*/
static class ClientData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// number of the bucket
private int bucketNumber;
@@ -2111,6 +2126,8 @@ public class TargetLock implements Lock, Serializable {
* single 'TargetLock'.
*/
static class ClientDataRecord implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// contains key, ownerKey, uuid
private Identity identity;
@@ -2135,6 +2152,8 @@ public class TargetLock implements Lock, Serializable {
* Information derived from the 'GlobalLocks' adjunct to a single bucket.
*/
static class ServerData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// number of the bucket
private int bucketNumber;
@@ -2161,6 +2180,8 @@ public class TargetLock implements Lock, Serializable {
* 'TargetLock' audit.
*/
static class AuditData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// sending UUID
private UUID hostUuid;
@@ -2382,7 +2403,7 @@ public class TargetLock implements Lock, Serializable {
Object decodedData =
Util.deserialize(Base64.getDecoder().decode(encodedData));
if (decodedData instanceof AuditData) {
- return (AuditData)decodedData;
+ return (AuditData) decodedData;
} else {
logger.error(
"TargetLock.AuditData.decode returned instance of class {}",
@@ -2406,7 +2427,7 @@ public class TargetLock implements Lock, Serializable {
static TimerTask timerTask = null;
// maps 'Server' to audit data associated with that server
- Map<Server,AuditData> auditMap = new IdentityHashMap<>();
+ Map<Server, AuditData> auditMap = new IdentityHashMap<>();
/**
* Run a single audit cycle.
@@ -2556,7 +2577,7 @@ public class TargetLock implements Lock, Serializable {
* remote server.
*/
void build() {
- for (int i = 0 ; i < Bucket.BUCKETCOUNT ; i += 1) {
+ for (int i = 0; i < Bucket.BUCKETCOUNT; i += 1) {
Bucket bucket = Bucket.getBucket(i);
// client data
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Util.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Util.java
index 66a9eac3..92d0994c 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Util.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Util.java
@@ -32,7 +32,6 @@ import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.Timer;
import java.util.UUID;
-
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/persistence/Persistence.java b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/persistence/Persistence.java
index 0f7321de..48bd1c1a 100644
--- a/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/persistence/Persistence.java
+++ b/feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/persistence/Persistence.java
@@ -36,7 +36,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -44,7 +43,6 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
-
import org.kie.api.event.rule.ObjectDeletedEvent;
import org.kie.api.event.rule.ObjectInsertedEvent;
import org.kie.api.event.rule.ObjectUpdatedEvent;
@@ -78,9 +76,9 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
private static final String QP_COUNT = "count";
private static final String QP_DEST = "dest";
- /***************************************/
- /* 'PolicySessionFeatureApi' interface */
- /***************************************/
+ /* ************************************* */
+ /* 'PolicySessionFeatureApi' interface */
+ /* ************************************* */
/**
* {@inheritDoc}
@@ -117,9 +115,9 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
}
}
- /*****************************/
- /* 'ServerPoolApi' interface */
- /*****************************/
+ /* *************************** */
+ /* 'ServerPoolApi' interface */
+ /* *************************** */
/**
* {@inheritDoc}
@@ -184,7 +182,7 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
for (PolicySession session : sbd.sessionData.keySet()) {
Object obj = session.getAdjunct(PersistenceRunnable.class);
if (obj instanceof PersistenceRunnable) {
- PersistenceRunnable pr = (PersistenceRunnable)obj;
+ PersistenceRunnable pr = (PersistenceRunnable) obj;
synchronized (pr.modifiedBuckets) {
// mark bucket associated with this session
// as modified
@@ -300,9 +298,9 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
session.getKieSession().addEventListener(this);
}
- /******************************/
- /* 'DroolsRunnable' interface */
- /******************************/
+ /* **************************** */
+ /* 'DroolsRunnable' interface */
+ /* **************************** */
/**
* {@inheritDoc}
@@ -364,9 +362,9 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
}
}
- /****************************************/
- /* 'RuleRuntimeEventListener' interface */
- /****************************************/
+ /* ************************************** */
+ /* 'RuleRuntimeEventListener' interface */
+ /* ************************************** */
/**
* {@inheritDoc}
@@ -462,7 +460,7 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
*/
static class SenderSessionBucketData {
// the set of all objects in the session associated with this bucket
- Map<Object,Object> droolsObjects = new IdentityHashMap<>();
+ Map<Object, Object> droolsObjects = new IdentityHashMap<>();
// used by the receiver to determine whether an update is really newer
int count = 0;
@@ -741,7 +739,7 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
// if we reach this point, we have decoded the persistent data
- final Map<?,?> droolsObjects = (Map<?,?>) obj;
+ final Map<?, ?> droolsObjects = (Map<?, ?>) obj;
// signal when restore is complete
final CountDownLatch sessionLatch = new CountDownLatch(1);
@@ -779,7 +777,7 @@ public class Persistence implements PolicySessionFeatureApi, ServerPoolApi {
bucket.putAdjunct(obj);
// send out updated date
- sendLockDataToBackups(bucket, (GlobalLocks)obj);
+ sendLockDataToBackups(bucket, (GlobalLocks) obj);
} else {
logger.error(RESTORE_BUCKET_ERROR
+ "Expected 'GlobalLocks', got '{}'",
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java
index 70dc2114..789dfe61 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/AdapterImpl.java
@@ -172,7 +172,7 @@ public class AdapterImpl extends Adapter {
TimeUnit.MILLISECONDS).until(() -> Leader.getLeader() != null);
// wait for each bucket to have an owner
- for (int i = 0 ; i < Bucket.BUCKETCOUNT ; i += 1) {
+ for (int i = 0; i < Bucket.BUCKETCOUNT; i += 1) {
Bucket bucket = Bucket.getBucket(i);
while (bucket.getOwner() == null) {
Thread.sleep(Math.min(endTime - System.currentTimeMillis(), 100L));
@@ -312,7 +312,7 @@ public class AdapterImpl extends Adapter {
*/
logger.info("{}: Calling 'sendEvent': packages = {}", this,
policySession.getKieSession().getKieBase().getKiePackages());
- ((TopicListener)policyController).onTopicEvent(
+ ((TopicListener) policyController).onTopicEvent(
CommInfrastructure.UEB, "JUNIT-TEST-TOPIC",
"{\"key\":\"" + key + "\"}");
}
@@ -374,7 +374,7 @@ public class AdapterImpl extends Adapter {
String rval = null;
// try up to 10000 numeric values to locate one on a particular host
- for (int i = 0 ; i < 10000 ; i += 1) {
+ for (int i = 0; i < 10000; i += 1) {
// generate key, and see if it is on the desired server
String testString = prefix + (startingIndex + i);
if (ServerWrapperImpl.getWrapper(
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java
index ca89d99a..ddd4d553 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/BucketWrapperImpl.java
@@ -22,7 +22,6 @@ package org.onap.policy.drools.serverpool;
import java.io.PrintStream;
import java.util.IdentityHashMap;
-
import org.onap.policy.drools.serverpooltest.BucketWrapper;
import org.onap.policy.drools.serverpooltest.ServerWrapper;
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java
index 468d12af..031c3323 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/ServerWrapperImpl.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.UUID;
-
import org.onap.policy.drools.serverpooltest.ServerWrapper;
/**
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java
index 4f496986..e170975a 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpool/TargetLockWrapperImpl.java
@@ -21,8 +21,6 @@
package org.onap.policy.drools.serverpool;
import java.io.Serializable;
-import java.util.IdentityHashMap;
-
import org.onap.policy.drools.core.lock.Lock;
import org.onap.policy.drools.core.lock.LockCallback;
import org.onap.policy.drools.serverpooltest.TargetLockWrapper;
@@ -32,6 +30,8 @@ import org.onap.policy.drools.serverpooltest.TargetLockWrapper;
* 'TargetLockWrapperImpl' class for each simulated host.
*/
public class TargetLockWrapperImpl implements TargetLockWrapper {
+ private static final long serialVersionUID = 1L;
+
// this is the 'TargetLock' instance associated with the wrapper
private TargetLock targetLock;
@@ -156,6 +156,8 @@ public class TargetLockWrapperImpl implements TargetLockWrapper {
* interface, translating it to a 'TargetLockWrapper.Owner' callback.
*/
public static class OwnerAdapter implements LockCallback, Serializable {
+ private static final long serialVersionUID = 1L;
+
// the 'TargetLockWrapper' instance to pass as an argument in the callback
TargetLockWrapper targetLock;
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java
index d5d836b4..22404605 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Adapter.java
@@ -95,7 +95,7 @@ public abstract class Adapter {
ClassLoader saveClassLoader =
Thread.currentThread().getContextClassLoader();
if (saveClassLoader instanceof URLClassLoader) {
- urls = ((URLClassLoader)saveClassLoader).getURLs();
+ urls = ((URLClassLoader) saveClassLoader).getURLs();
} else {
// the parent is not a 'URLClassLoader' --
// try to get this information from 'java.class.path'
@@ -111,7 +111,7 @@ public abstract class Adapter {
urls = tmpUrls.toArray(new URL[0]);
}
try {
- for (int i = 0 ; i < adapters.length ; i += 1) {
+ for (int i = 0; i < adapters.length; i += 1) {
/*
* Build a new 'ClassLoader' for this adapter. The
* 'ClassLoader' hierarchy is:
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java
index 7930bf27..a21f254d 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/BlockingClassLoader.java
@@ -162,7 +162,7 @@ public class BlockingClassLoader extends ClassLoader {
// being blocked
int index = name.lastIndexOf('.');
if (index >= 0) {
- if (packages.contains(name.substring(0,index))) {
+ if (packages.contains(name.substring(0, index))) {
throw(new ClassNotFoundException(name));
}
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java
index 8513c1f0..03004844 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/SimDmaap.java
@@ -26,7 +26,6 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -35,7 +34,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -111,7 +109,7 @@ public class SimDmaap {
/* ============================================================ */
// maps topic name to 'Topic' instance
- static Map<String,Topic> topicTable = new ConcurrentHashMap<>();
+ static Map<String, Topic> topicTable = new ConcurrentHashMap<>();
/**
* Each instance of this class corresponds to a DMAAP or UEB topic.
@@ -121,7 +119,7 @@ public class SimDmaap {
String topic;
// maps group name into group instance
- Map<String,Group> groupTable = new ConcurrentHashMap<>();
+ Map<String, Group> groupTable = new ConcurrentHashMap<>();
/**
* Create or get a Topic.
@@ -179,7 +177,7 @@ public class SimDmaap {
// no more messages
break;
}
- String[] prefix = data.substring(cur,leftBrace).split("\\.");
+ String[] prefix = data.substring(cur, leftBrace).split("\\.");
if (prefix.length == 3) {
try {
// determine length of message, and advance current position
@@ -281,7 +279,7 @@ public class SimDmaap {
builder.append("[\"").append(message);
// add up to '<limit>-1' more messages
- for (int i = 1 ; i < limit ; i += 1) {
+ for (int i = 1; i < limit; i += 1) {
// fetch the next message -- don't wait if it isn't currently there
message = messages.poll();
if (message == null) {
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java
index ad4ba8e8..436cf77f 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/Test1.java
@@ -40,12 +40,10 @@ import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-
import org.awaitility.Durations;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.kie.api.runtime.KieSession;
import org.onap.policy.drools.core.DroolsRunnable;
import org.onap.policy.drools.serverpool.BucketWrapperImpl;
@@ -68,7 +66,7 @@ public class Test1 {
if (count > thr.length) {
count = thr.length;
}
- for (int i = 0 ; i < count ; i += 1) {
+ for (int i = 0; i < count; i += 1) {
StringBuilder sb = new StringBuilder();
sb.append(" ").append(thr[i]);
if (stackTrace) {
@@ -202,7 +200,7 @@ public class Test1 {
if (adapter == firstAdapter) {
// make sure an owner and primary backup have been chosen
// for each bucket (secondary backups aren't implemented yet)
- for (int i = 0 ; i < bucketStatic.getBucketCount() ; i += 1) {
+ for (int i = 0; i < bucketStatic.getBucketCount(); i += 1) {
BucketWrapper bucket = bucketStatic.getBucket(i);
assertNotNull(bucket.getOwner());
assertNotNull(bucket.getPrimaryBackup());
@@ -210,7 +208,7 @@ public class Test1 {
} else {
// make sure the bucket assignments are consistent with
// the primary backup
- for (int i = 0 ; i < bucketStatic.getBucketCount() ; i += 1) {
+ for (int i = 0; i < bucketStatic.getBucketCount(); i += 1) {
BucketWrapper firstBucket = firstBucketStatic.getBucket(i);
BucketWrapper bucket = bucketStatic.getBucket(i);
assertEquals(firstBucket.getOwner().getUuid(),
@@ -586,7 +584,7 @@ public class Test1 {
KieSession kieSession = newClient.getKieSession();
for (Object obj : new ArrayList<Object>(kieSession.getObjects())) {
if (obj instanceof KeywordWrapper) {
- KeywordWrapper kw = (KeywordWrapper)obj;
+ KeywordWrapper kw = (KeywordWrapper) obj;
if ("lmt.owner".equals(kw.id)) {
owner = kw.getObject(LockOwner.class);
@@ -705,6 +703,8 @@ public class Test1 {
// need a 'LockOwner' variant
final LockOwner owner = new LockOwner() {
+ private static final long serialVersionUID = 1L;
+
/**
* {@inheritDoc}
*/
@@ -840,6 +840,9 @@ public class Test1 {
*/
public static class LockOwner extends LinkedBlockingQueue<Object[]>
implements TargetLockWrapper.Owner, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
/**
* Constructor -- initialize the 'LinkedBlockingQueue'.
*/
@@ -873,6 +876,8 @@ public class Test1 {
* testing.
*/
public static class KeywordWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// this is the keyword, which determines the associated bucket,
// which then determines when this object is migrated
public String key;
diff --git a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java
index 43aa5de7..a937680f 100644
--- a/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java
+++ b/feature-server-pool/src/test/java/org/onap/policy/drools/serverpooltest/TestDroolsObject.java
@@ -21,8 +21,6 @@
package org.onap.policy.drools.serverpooltest;
import java.io.Serializable;
-import java.util.Objects;
-
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@@ -37,6 +35,8 @@ import lombok.ToString;
@ToString
@EqualsAndHashCode
public class TestDroolsObject implements Serializable {
+ private static final long serialVersionUID = 1L;
+
// determines the bucket number
private String key;