use of com.hazelcast.map.MapPartitionLostEvent in project hazelcast by hazelcast.
the class MapAddPartitionLostListenerMessageTask method call.
@Override
protected Object call() {
final ClientEndpoint endpoint = getEndpoint();
final MapService mapService = getService(MapService.SERVICE_NAME);
final MapPartitionLostListener listener = new MapPartitionLostListener() {
@Override
public void partitionLost(MapPartitionLostEvent event) {
if (endpoint.isAlive()) {
ClientMessage eventMessage = MapAddPartitionLostListenerCodec.encodeMapPartitionLostEvent(event.getPartitionId(), event.getMember().getUuid());
sendClientMessage(null, eventMessage);
}
}
};
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
String registrationId;
if (parameters.localOnly) {
registrationId = mapServiceContext.addLocalPartitionLostListener(listener, parameters.name);
} else {
registrationId = mapServiceContext.addPartitionLostListener(listener, parameters.name);
}
endpoint.addListenerDestroyAction(MapService.SERVICE_NAME, parameters.name, registrationId);
return registrationId;
}
use of com.hazelcast.map.MapPartitionLostEvent in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchMapPartitionLostEventData.
private void dispatchMapPartitionLostEventData(MapPartitionEventData eventData, ListenerAdapter listener) {
Member member = getMember(eventData);
MapPartitionLostEvent event = createMapPartitionLostEventData(eventData, member);
callListener(listener, event);
}
Aggregations