use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.
the class InternalPartitionServiceStackOverflowTest method test.
public void test(int partitionId) {
HazelcastInstance hz = createHazelcastInstance();
OperationService opService = getNode(hz).nodeEngine.getOperationService();
int iterations = 2000;
final CountDownLatch latch = new CountDownLatch(iterations);
for (int k = 0; k < iterations; k++) {
Operation op;
if (partitionId >= 0) {
op = new SlowPartitionAwareSystemOperation(latch, partitionId);
} else {
op = new SlowPartitionUnawareSystemOperation(latch);
}
op.setOperationResponseHandler(OperationResponseHandlerFactory.createEmptyResponseHandler());
opService.execute(op);
}
assertTrueEventually(new AssertTask() {
@Override
public void run() {
assertEquals(0, latch.getCount());
}
});
}
use of com.hazelcast.core.HazelcastInstance 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.core.HazelcastInstance in project hazelcast by hazelcast.
the class InternalPartitionServiceLiteMemberTest method test_getPartition_nullPartitionOwnerOnMasterLiteMember.
/**
* GET PARTITION
**/
@Test
public void test_getPartition_nullPartitionOwnerOnMasterLiteMember() {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(instance);
assertNull(partitionService.getPartition(0).getOwnerOrNull());
}
use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.
the class InternalPartitionServiceLiteMemberTest method test_liteMemberCanTerminate_withClusterSize1.
/**
* TERMINATE
**/
@Test(timeout = 120000)
public void test_liteMemberCanTerminate_withClusterSize1() {
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
lite.getLifecycleService().terminate();
}
use of com.hazelcast.core.HazelcastInstance 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);
}
}
});
}
Aggregations