Skip to content
Permalink
Browse files

Implement configurable reentrancy for FencedLock

  • Loading branch information...
metanet authored and mdogan committed Jan 11, 2019
1 parent 4214776 commit b629fc91d1fd52e06e3be7fc90ccb41b71c1837a
Showing with 2,214 additions and 1,062 deletions.
  1. +18 −34 ...lient/src/main/java/com/hazelcast/client/cp/internal/datastructures/lock/RaftFencedLockProxy.java
  2. +2 −1 ...rc/main/java/com/hazelcast/client/cp/internal/datastructures/lock/RaftFencedLockProxyFactory.java
  3. +1 −1 ...lcast-client/src/main/java/com/hazelcast/client/cp/internal/datastructures/lock/package-info.java
  4. +64 −0 ...cast-client/src/main/java/com/hazelcast/client/cp/internal/session/ClientProxySessionManager.java
  5. +1 −1 hazelcast-client/src/main/java/com/hazelcast/client/impl/clientside/CPSubsystemImpl.java
  6. +46 −0 ...va/com/hazelcast/client/cp/internal/datastructures/lock/BoundedReentrantFencedLockClientTest.java
  7. +2 −2 ...nternal/datastructures/lock/{RaftFencedLockClientBasicTest.java → FencedLockClientBasicTest.java}
  8. +46 −0 ...t/java/com/hazelcast/client/cp/internal/datastructures/lock/NonReentrantFencedLockClientTest.java
  9. +29 −6 hazelcast-spring/src/main/java/com/hazelcast/spring/HazelcastConfigBeanDefinitionParser.java
  10. +41 −1 hazelcast-spring/src/main/resources/hazelcast-spring-3.12.xsd
  11. +11 −4 hazelcast-spring/src/test/java/com/hazelcast/spring/TestFullApplicationContext.java
  12. +12 −2 hazelcast-spring/src/test/resources/com/hazelcast/spring/fullConfig-applicationContext-hazelcast.xml
  13. +4 −0 hazelcast/src/main/java/com/hazelcast/client/impl/protocol/ClientExceptions.java
  14. +2 −0 hazelcast/src/main/java/com/hazelcast/client/impl/protocol/ClientProtocolErrorCodes.java
  15. +14 −4 hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java
  16. +22 −3 hazelcast/src/main/java/com/hazelcast/config/MemberDomConfigProcessor.java
  17. +3 −0 hazelcast/src/main/java/com/hazelcast/config/cp/AbstractCPObjectConfig.java
  18. +13 −3 hazelcast/src/main/java/com/hazelcast/config/cp/CPSemaphoreConfig.java
  19. +76 −14 hazelcast/src/main/java/com/hazelcast/config/cp/CPSubsystemConfig.java
  20. +115 −0 hazelcast/src/main/java/com/hazelcast/config/cp/FencedLockConfig.java
  21. +2 −2 hazelcast/src/main/java/com/hazelcast/core/ISemaphore.java
  22. +1 −0 hazelcast/src/main/java/com/hazelcast/cp/CPSubsystem.java
  23. +1 −1 hazelcast/src/main/java/com/hazelcast/cp/internal/CPSubsystemImpl.java
  24. +1 −1 ...main/java/com/hazelcast/cp/internal/datastructures/countdownlatch/RaftCountDownLatchRegistry.java
  25. +97 −0 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/AcquireResult.java
  26. +124 −168 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java
  27. +4 −8 ...lcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLockDataSerializerHook.java
  28. +3 −3 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLockOwnershipState.java
  29. +27 −27 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLockRegistry.java
  30. +38 −52 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLockService.java
  31. +79 −0 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/ReleaseResult.java
  32. +0 −3 ...t/src/main/java/com/hazelcast/cp/internal/datastructures/lock/client/AbstractLockMessageTask.java
  33. +0 −56 ...st/src/main/java/com/hazelcast/cp/internal/datastructures/lock/client/ForceUnlockMessageTask.java
  34. +1 −9 ...ain/java/com/hazelcast/cp/internal/datastructures/lock/client/LockMessageTaskFactoryProvider.java
  35. +1 −3 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/client/UnlockMessageTask.java
  36. +0 −103 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/operation/ForceUnlockOp.java
  37. +11 −4 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/operation/LockOp.java
  38. +8 −7 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/operation/TryLockOp.java
  39. +3 −28 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/operation/UnlockOp.java
  40. +1 −1 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/package-info.java
  41. +141 −194 ...rc/main/java/com/hazelcast/cp/internal/datastructures/lock/proxy/AbstractRaftFencedLockProxy.java
  42. +16 −20 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/proxy/RaftFencedLockProxy.java
  43. +7 −7 ...lcast/src/main/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSemaphoreRegistry.java
  44. +2 −2 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSemaphoreService.java
  45. +2 −2 ...n/java/com/hazelcast/cp/internal/datastructures/semaphore/client/GetSemaphoreTypeMessageTask.java
  46. +4 −0 .../src/main/java/com/hazelcast/cp/internal/datastructures/spi/blocking/AbstractBlockingService.java
  47. +4 −0 hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/spi/blocking/ResourceRegistry.java
  48. +1 −1 hazelcast/src/main/java/com/hazelcast/cp/internal/session/AbstractProxySessionManager.java
  49. +2 −1 hazelcast/src/main/java/com/hazelcast/cp/internal/session/ProxySessionManagerService.java
  50. +162 −105 hazelcast/src/main/java/com/hazelcast/cp/{ → lock}/FencedLock.java
  51. +40 −0 hazelcast/src/main/java/com/hazelcast/cp/lock/exception/LockAcquireLimitExceededException.java
  52. +36 −0 hazelcast/src/main/java/com/hazelcast/cp/lock/exception/LockOwnershipLostException.java
  53. +20 −0 hazelcast/src/main/java/com/hazelcast/cp/lock/exception/package-info.java
  54. +20 −0 hazelcast/src/main/java/com/hazelcast/cp/lock/package-info.java
  55. +19 −1 hazelcast/src/main/java/com/hazelcast/internal/dynamicconfig/DynamicCPSubsystemConfig.java
  56. +41 −1 hazelcast/src/main/resources/hazelcast-config-3.12.xsd
  57. +21 −5 hazelcast/src/test/java/com/hazelcast/config/ConfigCompatibilityChecker.java
  58. +7 −2 hazelcast/src/test/java/com/hazelcast/config/ConfigXmlGeneratorTest.java
  59. +25 −8 hazelcast/src/test/java/com/hazelcast/config/XMLConfigBuilderTest.java
  60. +232 −0 ...t/src/test/java/com/hazelcast/cp/internal/datastructures/lock/BoundedReentrantFencedLockTest.java
  61. +13 −5 ...t/cp/internal/datastructures/lock/{RaftFencedLockAdvancedTest.java → FencedLockAdvancedTest.java}
  62. +157 −79 ...zelcast/cp/internal/datastructures/lock/{RaftFencedLockBasicTest.java → FencedLockBasicTest.java}
  63. +113 −71 ...ast/cp/internal/datastructures/lock/{RaftFencedLockFailureTest.java → FencedLockFailureTest.java}
  64. +189 −0 ...lcast/src/test/java/com/hazelcast/cp/internal/datastructures/lock/NonReentrantFencedLockTest.java
  65. +1 −1 ...t/src/test/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSemaphoreAdvancedTest.java
  66. +1 −1 ...st/src/test/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSemaphoreFailureTest.java
  67. +1 −1 ...t/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSessionAwareSemaphoreBasicTest.java
  68. +1 −1 ...st/java/com/hazelcast/cp/internal/datastructures/semaphore/RaftSessionlessSemaphoreBasicTest.java
  69. +12 −2 hazelcast/src/test/resources/hazelcast-fullconfig.xml
@@ -24,7 +24,7 @@
import com.hazelcast.client.spi.impl.ClientInvocationFuture;
import com.hazelcast.client.util.ClientDelegatingFuture;
import com.hazelcast.cp.CPGroupId;
import com.hazelcast.cp.FencedLock;
import com.hazelcast.cp.lock.FencedLock;
import com.hazelcast.cp.internal.RaftGroupId;
import com.hazelcast.cp.internal.datastructures.lock.RaftLockOwnershipState;
import com.hazelcast.cp.internal.datastructures.lock.RaftLockService;
@@ -40,7 +40,6 @@
import static com.hazelcast.client.impl.protocol.util.ParameterUtil.calculateDataSize;
import static com.hazelcast.cp.internal.RaftGroupId.dataSize;
import static com.hazelcast.cp.internal.datastructures.lock.client.LockMessageTaskFactoryProvider.DESTROY_TYPE;
import static com.hazelcast.cp.internal.datastructures.lock.client.LockMessageTaskFactoryProvider.FORCE_UNLOCK_TYPE;
import static com.hazelcast.cp.internal.datastructures.lock.client.LockMessageTaskFactoryProvider.LOCK_OWNERSHIP_STATE;
import static com.hazelcast.cp.internal.datastructures.lock.client.LockMessageTaskFactoryProvider.LOCK_TYPE;
import static com.hazelcast.cp.internal.datastructures.lock.client.LockMessageTaskFactoryProvider.TRY_LOCK_TYPE;
@@ -53,6 +52,7 @@

private static final ClientMessageDecoder BOOLEAN_RESPONSE_DECODER = new BooleanResponseDecoder();
private static final ClientMessageDecoder LOCK_OWNERSHIP_STATE_RESPONSE_DECODER = new RaftLockOwnershipStateResponseDecoder();
private static final ClientMessageDecoder LONG_RESPONSE_DECODER = new LongResponseDecoder();


private final FencedLockImpl lock;
@@ -102,11 +102,6 @@ public void unlock() {
lock.unlock();
}

@Override
public void forceUnlock() {
lock.forceUnlock();
}

@Override
public long getFence() {
return lock.getFence();
@@ -123,8 +118,8 @@ public boolean isLockedByCurrentThread() {
}

@Override
public int getLockCountIfLockedByCurrentThread() {
return lock.getLockCountIfLockedByCurrentThread();
public int getLockCount() {
return lock.getLockCount();
}

@Override
@@ -166,17 +161,6 @@ private static ClientMessage encodeRequest(int messageTypeId, CPGroupId groupId,
return msg;
}

private static ClientMessage encodeRequest(int messageTypeId, CPGroupId groupId, String name, long sessionId,
long threadId, UUID invUid, int val) {
int dataSize = ClientMessage.HEADER_SIZE + dataSize(groupId) + calculateDataSize(name) + Bits.LONG_SIZE_IN_BYTES * 4
+ Bits.INT_SIZE_IN_BYTES;
ClientMessage msg = prepareClientMessage(groupId, name, dataSize, messageTypeId);
setRequestParams(msg, sessionId, threadId, invUid);
msg.set(val);
msg.updateFrameLength();
return msg;
}

private static ClientMessage encodeRequest(int messageTypeId, CPGroupId groupId, String name, long sessionId,
long threadId, UUID invUid, long val) {
int dataSize = ClientMessage.HEADER_SIZE + dataSize(groupId) + calculateDataSize(name) + Bits.LONG_SIZE_IN_BYTES * 5;
@@ -231,35 +215,35 @@ public RaftLockOwnershipState decodeClientMessage(ClientMessage msg) {
}
}

private static class LongResponseDecoder implements ClientMessageDecoder {
@Override
public Long decodeClientMessage(ClientMessage msg) {
return msg.getLong();
}
}

private class FencedLockImpl extends AbstractRaftFencedLockProxy {
FencedLockImpl(AbstractProxySessionManager sessionManager, CPGroupId groupId, String proxyName, String objectName) {
super(sessionManager, groupId, proxyName, objectName);
}

@Override
protected InternalCompletableFuture<RaftLockOwnershipState> doLock(long sessionId, long threadId, UUID invocationUid) {
protected InternalCompletableFuture<Long> doLock(long sessionId, long threadId, UUID invocationUid) {
ClientMessage msg = encodeRequest(LOCK_TYPE, groupId, objectName, sessionId, threadId, invocationUid);
return invoke(objectName, msg, LOCK_OWNERSHIP_STATE_RESPONSE_DECODER);
return invoke(objectName, msg, LONG_RESPONSE_DECODER);
}

@Override
protected InternalCompletableFuture<RaftLockOwnershipState> doTryLock(long sessionId, long threadId, UUID invocationUid,
long timeoutMillis) {
protected InternalCompletableFuture<Long> doTryLock(long sessionId, long threadId, UUID invocationUid,
long timeoutMillis) {
ClientMessage msg = encodeRequest(TRY_LOCK_TYPE, groupId, objectName, sessionId, threadId, invocationUid,
timeoutMillis);
return invoke(objectName, msg, LOCK_OWNERSHIP_STATE_RESPONSE_DECODER);
}

@Override
protected InternalCompletableFuture<Object> doUnlock(long sessionId, long threadId, UUID invocationUid,
int releaseCount) {
ClientMessage msg = encodeRequest(UNLOCK_TYPE, groupId, objectName, sessionId, threadId, invocationUid, releaseCount);
return invoke(objectName, msg, BOOLEAN_RESPONSE_DECODER);
return invoke(objectName, msg, LONG_RESPONSE_DECODER);
}

@Override
protected InternalCompletableFuture<Object> doForceUnlock(UUID invocationUid, long expectedFence) {
ClientMessage msg = encodeRequest(FORCE_UNLOCK_TYPE, groupId, objectName, -1, -1, invocationUid, expectedFence);
protected InternalCompletableFuture<Boolean> doUnlock(long sessionId, long threadId, UUID invocationUid) {
ClientMessage msg = encodeRequest(UNLOCK_TYPE, groupId, objectName, sessionId, threadId, invocationUid);
return invoke(objectName, msg, BOOLEAN_RESPONSE_DECODER);
}

@@ -29,14 +29,15 @@
import com.hazelcast.cp.CPGroupId;
import com.hazelcast.cp.internal.RaftGroupId;
import com.hazelcast.cp.internal.datastructures.spi.client.RaftGroupTaskFactoryProvider;
import com.hazelcast.cp.lock.FencedLock;
import com.hazelcast.spi.InternalCompletableFuture;

import static com.hazelcast.client.impl.protocol.util.ParameterUtil.calculateDataSize;
import static com.hazelcast.cp.internal.RaftService.getObjectNameForProxy;

/**
* Creates client-side proxies for
* Raft-based {@link com.hazelcast.cp.FencedLock}
* Raft-based {@link FencedLock}
*/
public class RaftFencedLockProxyFactory extends ClientProxyFactoryWithContext implements ClientProxyFactory {

@@ -16,6 +16,6 @@

/**
* Contains client-side proxy impl of
* Raft-based {@link com.hazelcast.cp.FencedLock}
* Raft-based {@link com.hazelcast.cp.lock.FencedLock}
*/
package com.hazelcast.client.cp.internal.datastructures.lock;
@@ -26,27 +26,36 @@
import com.hazelcast.client.util.ClientDelegatingFuture;
import com.hazelcast.core.ICompletableFuture;
import com.hazelcast.cp.CPGroupId;
import com.hazelcast.cp.lock.exception.LockAcquireLimitExceededException;
import com.hazelcast.cp.lock.exception.LockOwnershipLostException;
import com.hazelcast.cp.internal.RaftGroupId;
import com.hazelcast.cp.internal.datastructures.exception.WaitKeyCancelledException;
import com.hazelcast.cp.internal.session.AbstractProxySessionManager;
import com.hazelcast.cp.internal.session.SessionExpiredException;
import com.hazelcast.cp.internal.session.SessionResponse;
import com.hazelcast.cp.internal.session.client.SessionMessageTaskFactoryProvider;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Bits;
import com.hazelcast.spi.InternalCompletableFuture;

import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import static com.hazelcast.client.impl.protocol.ClientProtocolErrorCodes.LOCK_ACQUIRE_LIMIT_EXCEEDED_EXCEPTION;
import static com.hazelcast.client.impl.protocol.ClientProtocolErrorCodes.LOCK_OWNERSHIP_LOST_EXCEPTION;
import static com.hazelcast.client.impl.protocol.ClientProtocolErrorCodes.SESSION_EXPIRED_EXCEPTION;
import static com.hazelcast.client.impl.protocol.ClientProtocolErrorCodes.WAIT_KEY_CANCELLED_EXCEPTION;
import static com.hazelcast.cp.internal.datastructures.semaphore.client.SemaphoreMessageTaskFactoryProvider.GENERATE_THREAD_ID_TYPE;
import static java.util.concurrent.TimeUnit.MILLISECONDS;

/**
* Client-side implementation of Raft proxy session manager
*/
public class ClientProxySessionManager extends AbstractProxySessionManager {

public static final long SHUTDOWN_TIMEOUT_SECONDS = 60;
public static final long SHUTDOWN_WAIT_SLEEP_MILLIS = 10;
private static final ClientMessageDecoder SESSION_RESPONSE_DECODER = new SessionResponseDecoder();
private static final ClientMessageDecoder BOOLEAN_RESPONSE_DECODER = new BooleanResponseDecoder();

@@ -67,6 +76,18 @@ public Throwable createException(String message, Throwable cause) {
return new WaitKeyCancelledException(message, cause);
}
});
factory.register(LOCK_ACQUIRE_LIMIT_EXCEEDED_EXCEPTION, LockAcquireLimitExceededException.class, new ExceptionFactory() {
@Override
public Throwable createException(String message, Throwable cause) {
return new LockAcquireLimitExceededException(message);
}
});
factory.register(LOCK_OWNERSHIP_LOST_EXCEPTION, LockOwnershipLostException.class, new ExceptionFactory() {
@Override
public Throwable createException(String message, Throwable cause) {
return new LockOwnershipLostException(message);
}
});
}

@Override
@@ -137,6 +158,49 @@ protected SessionResponse requestNewSession(CPGroupId groupId) {
return invoke(msg, BOOLEAN_RESPONSE_DECODER);
}

@Override
public Map<CPGroupId, ICompletableFuture<Object>> shutdown() {
Map<CPGroupId, ICompletableFuture<Object>> futures = super.shutdown();

ILogger logger = client.getLoggingService().getLogger(getClass());

long remainingTimeNanos = TimeUnit.SECONDS.toNanos(SHUTDOWN_TIMEOUT_SECONDS);

while (remainingTimeNanos > 0) {
int closed = 0;

for (Map.Entry<CPGroupId, ICompletableFuture<Object>> entry : futures.entrySet()) {
CPGroupId groupId = entry.getKey();
ICompletableFuture<Object> f = entry.getValue();
if (f.isDone()) {
closed++;
try {
f.get();
logger.fine("Session closed for " + groupId);
} catch (Exception e) {
logger.warning("Close session failed for " + groupId, e);

}
}
}

if (closed == futures.size()) {
break;
}

try {
Thread.sleep(SHUTDOWN_WAIT_SLEEP_MILLIS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return futures;
}

remainingTimeNanos -= MILLISECONDS.toNanos(SHUTDOWN_WAIT_SLEEP_MILLIS);
}

return futures;
}

private <T> InternalCompletableFuture<T> invoke(ClientMessage msg, ClientMessageDecoder decoder) {
ClientInvocationFuture future = new ClientInvocation(client, msg, "session").invoke();
return new ClientDelegatingFuture<T>(future, client.getSerializationService(), decoder);
@@ -22,7 +22,7 @@
import com.hazelcast.core.ISemaphore;
import com.hazelcast.cp.CPSubsystem;
import com.hazelcast.cp.CPSubsystemManagementService;
import com.hazelcast.cp.FencedLock;
import com.hazelcast.cp.lock.FencedLock;
import com.hazelcast.cp.CPSessionManagementService;
import com.hazelcast.cp.internal.datastructures.atomiclong.RaftAtomicLongService;
import com.hazelcast.cp.internal.datastructures.atomicref.RaftAtomicRefService;
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
*
* 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.
*/

package com.hazelcast.client.cp.internal.datastructures.lock;

import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.cp.internal.datastructures.lock.BoundedReentrantFencedLockTest;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

@RunWith(HazelcastSerialClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class BoundedReentrantFencedLockClientTest extends BoundedReentrantFencedLockTest {

@Override
protected TestHazelcastInstanceFactory createTestFactory() {
return new TestHazelcastFactory();
}

@Override
protected HazelcastInstance[] createInstances() {
HazelcastInstance[] instances = super.createInstances();
TestHazelcastFactory f = (TestHazelcastFactory) factory;
lockInstance = f.newHazelcastClient();
return instances;
}

}
@@ -19,7 +19,7 @@
import com.hazelcast.client.impl.clientside.HazelcastClientProxy;
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.cp.internal.datastructures.lock.RaftFencedLockBasicTest;
import com.hazelcast.cp.internal.datastructures.lock.FencedLockBasicTest;
import com.hazelcast.cp.internal.session.AbstractProxySessionManager;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.TestHazelcastInstanceFactory;
@@ -33,7 +33,7 @@

@RunWith(HazelcastSerialClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class RaftFencedLockClientBasicTest extends RaftFencedLockBasicTest {
public class FencedLockClientBasicTest extends FencedLockBasicTest {

@Override
protected TestHazelcastInstanceFactory createTestFactory() {
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
*
* 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.
*/

package com.hazelcast.client.cp.internal.datastructures.lock;

import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.cp.internal.datastructures.lock.NonReentrantFencedLockTest;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

@RunWith(HazelcastSerialClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class NonReentrantFencedLockClientTest extends NonReentrantFencedLockTest {

@Override
protected TestHazelcastInstanceFactory createTestFactory() {
return new TestHazelcastFactory();
}

@Override
protected HazelcastInstance[] createInstances() {
HazelcastInstance[] instances = super.createInstances();
TestHazelcastFactory f = (TestHazelcastFactory) factory;
lockInstance = f.newHazelcastClient();
return instances;
}

}

0 comments on commit b629fc9

Please sign in to comment.
You can’t perform that action at this time.