コード例 #1
0
  protected Set<Data> keySetInternal() {
    final NodeEngine nodeEngine = getNodeEngine();
    try {

      Map<Integer, Object> results =
          nodeEngine
              .getOperationService()
              .invokeOnAllPartitions(
                  CollectionService.SERVICE_NAME,
                  new MultiMapOperationFactory(proxyId, OperationFactoryType.KEY_SET));
      Set<Data> keySet = new HashSet<Data>();
      for (Object result : results.values()) {
        if (result == null) {
          continue;
        }
        CollectionResponse response = nodeEngine.toObject(result);
        if (response.getCollection() != null) {
          keySet.addAll(response.getCollection());
        }
      }
      return keySet;
    } catch (Throwable throwable) {
      throw ExceptionUtil.rethrow(throwable);
    }
  }
コード例 #2
0
 public int size() {
   final NodeEngine nodeEngine = getNodeEngine();
   try {
     Map<Integer, Object> results =
         nodeEngine
             .getOperationService()
             .invokeOnAllPartitions(
                 CollectionService.SERVICE_NAME,
                 new MultiMapOperationFactory(proxyId, OperationFactoryType.SIZE));
     int size = 0;
     for (Object obj : results.values()) {
       if (obj == null) {
         continue;
       }
       Integer result = nodeEngine.toObject(obj);
       size += result;
     }
     return size;
   } catch (Throwable throwable) {
     throw ExceptionUtil.rethrow(throwable);
   }
 }
コード例 #3
0
 protected boolean containsInternal(Data key, Data value) {
   final NodeEngine nodeEngine = getNodeEngine();
   try {
     Map<Integer, Object> results =
         nodeEngine
             .getOperationService()
             .invokeOnAllPartitions(
                 CollectionService.SERVICE_NAME,
                 new MultiMapOperationFactory(proxyId, OperationFactoryType.CONTAINS, key, value));
     for (Object obj : results.values()) {
       if (obj == null) {
         continue;
       }
       Boolean result = nodeEngine.toObject(obj);
       if (result) {
         return true;
       }
     }
     return false;
   } catch (Throwable throwable) {
     throw ExceptionUtil.rethrow(throwable);
   }
 }