this.includeValue = includeValue;
}
public Object call() throws Exception {
final ClientEndpoint endpoint = getEndpoint();
final MultiMapService service = getService();
EntryListener listener = new EntryAdapter() {
@Override
public void onEntryEvent(EntryEvent event) {
if (endpoint.isAlive()) {
if (!(event instanceof DataAwareEntryEvent)) {
throw new IllegalArgumentException("Expecting: DataAwareEntryEvent, Found: "
+ event.getClass().getSimpleName());
}
DataAwareEntryEvent dataAwareEntryEvent = (DataAwareEntryEvent) event;
Data key = dataAwareEntryEvent.getKeyData();
Data value = dataAwareEntryEvent.getNewValueData();
final EntryEventType type = event.getEventType();
final String uuid = event.getMember().getUuid();
PortableEntryEvent portableEntryEvent = new PortableEntryEvent(key, value, null, type, uuid);
endpoint.sendEvent(portableEntryEvent, getCallId());
}
}
@Override
public void onMapEvent(MapEvent event) {
if (endpoint.isAlive()) {
final EntryEventType type = event.getEventType();
final String uuid = event.getMember().getUuid();
PortableEntryEvent portableEntryEvent =
new PortableEntryEvent(type, uuid, event.getNumberOfEntriesAffected());
endpoint.sendEvent(portableEntryEvent, getCallId());
}
}
};
String registrationId = service.addListener(name, listener, key, includeValue, false);
endpoint.setListenerRegistration(MultiMapService.SERVICE_NAME, name, registrationId);
return registrationId;
}