use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.
the class RaftInvocationManager method invoke.
public <T> InternalCompletableFuture<T> invoke(CPGroupId groupId, RaftOp raftOp, boolean deserializeResponse) {
if (cpSubsystemEnabled) {
Operation operation = new DefaultRaftReplicateOp(groupId, raftOp);
Invocation invocation = new RaftInvocation(operationService.getInvocationContext(), raftInvocationContext, groupId, operation, invocationMaxRetryCount, invocationRetryPauseMillis, operationCallTimeout, deserializeResponse);
return invocation.invoke();
}
return invokeOnPartition(new UnsafeRaftReplicateOp(groupId, raftOp), deserializeResponse);
}
use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.
the class RaftInvocationFailureTest method test_invocationFailsWithMemberLeftException_when_thereAreRetryableExceptionsAfterwards.
@Test
public void test_invocationFailsWithMemberLeftException_when_thereAreRetryableExceptionsAfterwards() throws ExecutionException, InterruptedException {
CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
waitAllForLeaderElection(instances, groupId);
HazelcastInstance leader = getLeaderInstance(instances, groupId);
Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp2()), 10, 50, 60000).invoke();
try {
f.get(60, TimeUnit.SECONDS);
fail();
} catch (Exception e) {
assertInstanceOf(IndeterminateOperationStateException.class, e.getCause());
}
assertTrue(COMMIT_COUNT.get() > groupSize);
}
use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.
the class RaftInvocationFailureTest method test_invocationFailsWitNonRetryableException_when_thereAreRetryableExceptionsAfterIndeterminateOperationState.
@Test
public void test_invocationFailsWitNonRetryableException_when_thereAreRetryableExceptionsAfterIndeterminateOperationState() throws ExecutionException, InterruptedException {
CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
waitAllForLeaderElection(instances, groupId);
HazelcastInstance leader = getLeaderInstance(instances, groupId);
Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp5()), 10, 50, 60000).invoke();
try {
f.get(60, TimeUnit.SECONDS);
fail();
} catch (Exception e) {
assertInstanceOf(IllegalStateException.class, e.getCause());
}
assertTrue(COMMIT_COUNT.get() > groupSize);
}
use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.
the class RaftInvocationFailureTest method test_invocationFailsWithStaleAppendRequestException_when_thereAreRetryableExceptionsAfterwards.
@Test
public void test_invocationFailsWithStaleAppendRequestException_when_thereAreRetryableExceptionsAfterwards() throws ExecutionException, InterruptedException {
CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
waitAllForLeaderElection(instances, groupId);
HazelcastInstance leader = getLeaderInstance(instances, groupId);
Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp3()), 100, 500, 60000).invoke();
try {
f.get(60, TimeUnit.SECONDS);
fail();
} catch (Exception e) {
assertInstanceOf(IndeterminateOperationStateException.class, e.getCause());
}
assertTrue(COMMIT_COUNT.get() > groupSize);
}
use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.
the class RaftInvocationFailureTest method test_invocationFailsOnMemberLeftException.
@Test
public void test_invocationFailsOnMemberLeftException() throws ExecutionException, InterruptedException {
CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
waitAllForLeaderElection(instances, groupId);
HazelcastInstance leader = getLeaderInstance(instances, groupId);
Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp()), 10, 50, 60000).invoke();
try {
f.get(60, TimeUnit.SECONDS);
fail();
} catch (Exception e) {
assertInstanceOf(IndeterminateOperationStateException.class, e.getCause());
}
assertTrue(COMMIT_COUNT.get() <= groupSize);
}
Aggregations