use of com.hazelcast.spi.partition.IPartitionLostEvent in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method test_partitionLostListener_invoked.
@Test
public void test_partitionLostListener_invoked() {
final HazelcastInstance instance = hazelcastFactory.newHazelcastInstance();
final HazelcastInstance client = hazelcastFactory.newHazelcastClient();
warmUpPartitions(instance, client);
final EventCollectingPartitionLostListener listener = new EventCollectingPartitionLostListener();
client.getPartitionService().addPartitionLostListener(listener);
assertRegistrationsSizeEventually(instance, 1);
final InternalPartitionServiceImpl partitionService = getNode(instance).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
partitionService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
assertPartitionLostEventEventually(listener, partitionId);
}
use of com.hazelcast.spi.partition.IPartitionLostEvent in project hazelcast by hazelcast.
the class PartitionEventManager method sendPartitionLostEvent.
public void sendPartitionLostEvent(int partitionId, int lostReplicaIndex) {
final IPartitionLostEvent event = new IPartitionLostEvent(partitionId, lostReplicaIndex, nodeEngine.getThisAddress());
final InternalPartitionLostEventPublisher publisher = new InternalPartitionLostEventPublisher(nodeEngine, event);
nodeEngine.getExecutionService().execute(SYSTEM_EXECUTOR, publisher);
}
Aggregations