use of com.hazelcast.partition.PartitionLostEvent in project hazelcast by hazelcast.
the class AddPartitionLostListenerMessageTask method call.
@Override
protected Object call() throws Exception {
final IPartitionService partitionService = getService(getServiceName());
final PartitionLostListener listener = new PartitionLostListener() {
@Override
public void partitionLost(PartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage = ClientAddPartitionLostListenerCodec.encodePartitionLostEvent(event.getPartitionId(), event.getLostBackupCount(), event.getEventSource());
sendClientMessage(null, eventMessage);
}
}
};
String registrationId;
if (parameters.localOnly) {
registrationId = partitionService.addLocalPartitionLostListener(listener);
} else {
registrationId = partitionService.addPartitionLostListener(listener);
}
endpoint.addListenerDestroyAction(getServiceName(), PARTITION_LOST_EVENT_TOPIC, registrationId);
return registrationId;
}
use of com.hazelcast.partition.PartitionLostEvent in project hazelcast by hazelcast.
the class PartitionEventManager method onPartitionLost.
public void onPartitionLost(IPartitionLostEvent event) {
assert event instanceof PartitionLostEvent;
EventService eventService = nodeEngine.getEventService();
Collection<EventRegistration> registrations = eventService.getRegistrations(SERVICE_NAME, PARTITION_LOST_EVENT_TOPIC);
eventService.publishEvent(SERVICE_NAME, registrations, event, event.getPartitionId());
}
Aggregations