private void removeInvalidationListener() {
   if (nearCache != null && nearCache.isInvalidateOnChange()) {
     String registrationId = nearCacheMembershipRegistrationId;
     if (registrationId != null) {
       clientContext.getListenerService().deregisterListener(registrationId);
     }
   }
 }
 private void registerInvalidationListener() {
   if (nearCache != null && nearCache.isInvalidateOnChange()) {
     Client client = clientContext.getClusterService().getLocalClient();
     EventHandler handler = new NearCacheInvalidationHandler(client);
     ListenerMessageCodec listenerCodec = createInvalidationListenerCodec();
     nearCacheMembershipRegistrationId =
         clientContext.getListenerService().registerListener(listenerCodec, handler);
   }
 }