Exemplo n.º 1
0
 public void invalidateAllNearCaches(String mapName, Set<Data> keys) {
   if (!isNearCacheEnabled(mapName)) {
     return;
   }
   if (keys == null || keys.isEmpty()) {
     return;
   }
   // send operation.
   Operation operation =
       new NearCacheKeySetInvalidationOperation(mapName, keys).setServiceName(SERVICE_NAME);
   Collection<MemberImpl> members = nodeEngine.getClusterService().getMemberList();
   for (MemberImpl member : members) {
     try {
       if (member.localMember()) continue;
       nodeEngine.getOperationService().send(operation, member.getAddress());
     } catch (Throwable throwable) {
       logger.warning(throwable);
     }
   }
   // below local invalidation is for the case the data is cached before partition is
   // owned/migrated
   for (final Data key : keys) {
     invalidateNearCache(mapName, key);
   }
 }
Exemplo n.º 2
0
 public void invalidateAllNearCaches(String mapName, Data key) {
   if (!isNearCacheEnabled(mapName)) {
     return;
   }
   Collection<MemberImpl> members = nodeEngine.getClusterService().getMemberList();
   for (MemberImpl member : members) {
     try {
       if (member.localMember()) continue;
       Operation operation =
           new InvalidateNearCacheOperation(mapName, key).setServiceName(SERVICE_NAME);
       nodeEngine.getOperationService().send(operation, member.getAddress());
     } catch (Throwable throwable) {
       throw new HazelcastException(throwable);
     }
   }
   // below local invalidation is for the case the data is cached before partition is
   // owned/migrated
   invalidateNearCache(mapName, key);
 }