diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 15:25:32 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 15:26:47 +0100 |
commit | 4cfa2e2d98f6877d54da304ef17f096284430908 (patch) | |
tree | c9452d2bf6bb96fae9c1e8e2d8ce8f8d01e69d22 /plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java | |
parent | 0e23f7634e1e1fb31454c516974613335fcea1a4 (diff) |
Sonar/Checkstyle in service/plugins
Sonar and Checkstyle changes in plugins and services, and
knock on changes
Issue-ID: POLICY-1034
Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java')
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java index 9d35c30a8..123d834ff 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java @@ -20,6 +20,9 @@ package org.onap.policy.apex.plugins.context.distribution.hazelcast; +import com.hazelcast.core.Hazelcast; +import com.hazelcast.core.HazelcastInstance; + import java.util.Map; import org.onap.policy.apex.context.ContextException; @@ -28,9 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; -import com.hazelcast.core.Hazelcast; -import com.hazelcast.core.HazelcastInstance; - /** * This context distributor distributes context across threads in multiple JVMs on multiple hosts. * It uses hazelcast to distribute maps. @@ -70,12 +70,20 @@ public class HazelcastContextDistributor extends AbstractDistributor { // Create the hazelcast instance if it does not already exist if (hazelcastInstance == null) { - hazelcastInstance = Hazelcast.newHazelcastInstance(); + setHazelcastInstance(Hazelcast.newHazelcastInstance()); } LOGGER.exit("init(" + key + ")"); } + /** + * Set the hazelcast instance statically. + * @param newHazelcastInstance the hazelcast instance + */ + private static void setHazelcastInstance(HazelcastInstance newHazelcastInstance) { + hazelcastInstance = newHazelcastInstance; + } + /* * (non-Javadoc) * @@ -101,6 +109,6 @@ public class HazelcastContextDistributor extends AbstractDistributor { if (hazelcastInstance != null) { hazelcastInstance.shutdown(); } - hazelcastInstance = null; + setHazelcastInstance(null); } } |