summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-01-20 15:38:04 +0000
committerliamfallon <liam.fallon@est.tech>2021-01-20 15:43:51 +0000
commite3be60ce4b68b8e74ced19897fabf9e399beed1f (patch)
tree57b6a442ad66e67075ed2f8209c40a69d097d4e9
parent514e435b6ad37525d781b383081cd10c12c2ce46 (diff)
Update Hazelcast version, remove security vulnerability
Security vulnerabillitles were flagged in CLM in Hazelcast version 3.11-BETA-1. Hazelcast version 4.1.1 removes that vulnerability. The lock handling is slightly different in version 4.1.1 and the old ILock class is removed. The code is updated to use the new FencedLock locks. Issue-ID: POLICY-2943 Change-Id: I0cb7d3cb279fed17b3f8758e55902703491f4b5c Signed-off-by: liamfallon <liam.fallon@est.tech>
-rw-r--r--plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java17
-rw-r--r--plugins/pom.xml3
2 files changed, 11 insertions, 9 deletions
diff --git a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java
index e676e665e..caec244b8 100644
--- a/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java
+++ b/plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -21,7 +22,7 @@
package org.onap.policy.apex.plugins.context.locking.hazelcast;
import com.hazelcast.core.HazelcastInstance;
-import com.hazelcast.core.ILock;
+import com.hazelcast.cp.lock.FencedLock;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
@@ -35,8 +36,8 @@ public class HazelcastLock implements ReadWriteLock {
private final String lockId;
// The hazelcast lock
- private final ILock readLock;
- private final ILock writeLock;
+ private final FencedLock readLock;
+ private final FencedLock writeLock;
/**
* Create a Hazelcast lock.
@@ -48,8 +49,8 @@ public class HazelcastLock implements ReadWriteLock {
this.lockId = lockId;
// Create the Hazelcast read and write locks
- readLock = hazelcastInstance.getLock(lockId + "_READ");
- writeLock = hazelcastInstance.getLock(lockId + "_WRITE");
+ readLock = hazelcastInstance.getCPSubsystem().getLock(lockId + "_READ");
+ writeLock = hazelcastInstance.getCPSubsystem().getLock(lockId + "_WRITE");
}
/**
diff --git a/plugins/pom.xml b/plugins/pom.xml
index b10e8650b..e872e0fa8 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
+ Modifications Copyright (C) 2021 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,7 +35,7 @@
<description>Plugins for Apex that can be implemented with various 3PPs are implemented here.</description>
<properties>
- <version.hazelcast>3.11-BETA-1</version.hazelcast>
+ <version.hazelcast>4.1.1</version.hazelcast>
</properties>
<modules>