private void registerPartitionListener() { this.partitionLostRegistration = getNodeEngine().getPartitionService().addPartitionLostListener(new PartitionLostListener() { @Override public void partitionLost(final PartitionLostEvent event) { // use toArray before iteration since it is done under mutex ScheduledFutureProxy[] futures = lossListeners.toArray(new ScheduledFutureProxy[0]); for (ScheduledFutureProxy future : futures) { future.notifyPartitionLost(event); } } }); }
private void registerPartitionListener() { this.partitionLostRegistration = getNodeEngine().getPartitionService().addPartitionLostListener(new PartitionLostListener() { @Override public void partitionLost(final PartitionLostEvent event) { // use toArray before iteration since it is done under mutex ScheduledFutureProxy[] futures = lossListeners.toArray(new ScheduledFutureProxy[0]); for (ScheduledFutureProxy future : futures) { future.notifyPartitionLost(event); } } }); }
@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; }
@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; }