diff options
Diffstat (limited to 'plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src')
-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.java | 17 |
1 files changed, 9 insertions, 8 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"); } /** |