public void destroy() {
if (registrationId != null) {
BaseClientRemoveListenerRequest request;
if (cacheType == ClientNearCacheType.Map) {
request = new MapRemoveEntryListenerRequest(mapName, registrationId);
} else {
throw new IllegalStateException("Near cache is not available for this type of data structure");
}
ListenerUtil.stopListening(context, request, registrationId);
}