use of com.hazelcast.partition.NoDataMemberInClusterException in project hazelcast by hazelcast.
the class InternalPartitionServiceLiteMemberTest method test_getPartitionOwnerOrWait_onLiteMemberAfterDataMemberTerminates.
@Test
public void test_getPartitionOwnerOrWait_onLiteMemberAfterDataMemberTerminates() {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
final HazelcastInstance master = factory.newHazelcastInstance();
final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
warmUpPartitions(master, lite);
master.getLifecycleService().terminate();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
try {
final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(lite);
partitionService.getPartitionOwnerOrWait(0);
fail();
} catch (NoDataMemberInClusterException expected) {
ignore(expected);
}
}
});
}
use of com.hazelcast.partition.NoDataMemberInClusterException in project hazelcast by hazelcast.
the class InternalPartitionServiceLiteMemberTest method test_getPartitionOwnerOrWait_onLiteMemberAfterDataMemberShutsDown.
@Test
public void test_getPartitionOwnerOrWait_onLiteMemberAfterDataMemberShutsDown() {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
final HazelcastInstance master = factory.newHazelcastInstance();
final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
assertClusterSizeEventually(2, master);
assertClusterSizeEventually(2, lite);
warmUpPartitions(master, lite);
master.getLifecycleService().shutdown();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
try {
final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(lite);
partitionService.getPartitionOwnerOrWait(0);
fail();
} catch (NoDataMemberInClusterException expected) {
ignore(expected);
}
}
});
}
use of com.hazelcast.partition.NoDataMemberInClusterException in project hazelcast by hazelcast.
the class OperationServiceImpl_invokeOnPartitionLiteMemberTest method test_invokeOnPartition_onLiteMember.
@Test
public void test_invokeOnPartition_onLiteMember() throws InterruptedException {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
final InternalOperationService operationService = getOperationService(instance);
final InternalCompletableFuture<Object> future = operationService.invokeOnPartition(null, operation, 0);
try {
future.get();
fail("partition operation should not run on lite member!");
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof NoDataMemberInClusterException);
}
}
use of com.hazelcast.partition.NoDataMemberInClusterException in project hazelcast by hazelcast.
the class OperationServiceImpl_invokeOnPartitionLiteMemberTest method test_asyncInvokeOnPartition_onLiteMember.
@Test
public void test_asyncInvokeOnPartition_onLiteMember() {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
final InternalOperationService operationService = getOperationService(instance);
final DummyExecutionCallback callback = new DummyExecutionCallback();
operationService.asyncInvokeOnPartition(null, operation, 0, callback);
assertOpenEventually(callback.responseLatch);
assertTrue(callback.response instanceof NoDataMemberInClusterException);
}
use of com.hazelcast.partition.NoDataMemberInClusterException in project hazelcast by hazelcast.
the class KeysAssignmentOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
JobSupervisor supervisor = mapReduceService.getJobSupervisor(getName(), getJobId());
if (supervisor == null) {
this.result = new KeysAssignmentResult(NO_SUPERVISOR, null);
return;
}
Map<Object, Address> assignment = new HashMap<Object, Address>();
// Precheck if still all members are available
if (!supervisor.checkAssignedMembersAvailable()) {
TopologyChangedStrategy tcs = supervisor.getConfiguration().getTopologyChangedStrategy();
if (tcs == CANCEL_RUNNING_OPERATION) {
Exception exception = new TopologyChangedException();
supervisor.cancelAndNotify(exception);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
return;
// TODO Not yet fully supported
/* } else if (tcs == DISCARD_AND_RESTART) {
* supervisor.cancelNotifyAndRestart();
*/
} else {
Exception exception = new TopologyChangedException("Unknown or unsupported TopologyChangedStrategy");
supervisor.cancelAndNotify(exception);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
return;
}
}
try {
for (Object key : keys) {
Address address = supervisor.assignKeyReducerAddress(key);
assignment.put(key, address);
}
this.result = new KeysAssignmentResult(SUCCESSFUL, assignment);
} catch (NoDataMemberInClusterException e) {
supervisor.cancelAndNotify(e);
this.result = new KeysAssignmentResult(CHECK_STATE_FAILED, assignment);
}
}
Aggregations