From e3be60ce4b68b8e74ced19897fabf9e399beed1f Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 20 Jan 2021 15:38:04 +0000 Subject: 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 --- .../context/locking/hazelcast/HazelcastLock.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main') 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"); } /** -- cgit 1.2.3-korg