コード例 #1
0
  @Override
  public void deregisterCacheEntryListener(
      CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration) {
    if (cacheEntryListenerConfiguration == null) {
      throw new NullPointerException("CacheEntryListenerConfiguration can't be null");
    }
    final String regId = removeListenerLocally(cacheEntryListenerConfiguration);
    if (regId == null) {
      return;
    }

    ClientListenerService listenerService = clientContext.getListenerService();
    boolean isDeregistered =
        listenerService.stopListening(
            regId,
            new ListenerRemoveCodec() {
              @Override
              public ClientMessage encodeRequest(String realRegistrationId) {
                return CacheRemoveEntryListenerCodec.encodeRequest(
                    nameWithPrefix, realRegistrationId);
              }

              @Override
              public boolean decodeResponse(ClientMessage clientMessage) {
                return CacheRemoveEntryListenerCodec.decodeResponse(clientMessage).response;
              }
            });

    if (isDeregistered) {
      cacheConfig.removeCacheEntryListenerConfiguration(cacheEntryListenerConfiguration);
      // REMOVE ON OTHERS TOO
      updateCacheListenerConfigOnOtherNodes(cacheEntryListenerConfiguration, false);
    } else {
      addListenerLocally(regId, cacheEntryListenerConfiguration);
    }
  }
コード例 #2
0
 private void deregisterAllCacheEntryListener(Collection<String> listenerRegistrations) {
   ClientListenerService listenerService = clientContext.getListenerService();
   for (String regId : listenerRegistrations) {
     listenerService.deregisterListener(regId);
   }
 }