Пример #1
0
 protected void invokePutAllOperationFactory(
     Address address, final long size, int[] partitions, MapEntries[] entries) throws Exception {
   OperationFactory factory =
       operationProvider.createPutAllOperationFactory(name, partitions, entries);
   final long time = System.currentTimeMillis();
   operationService.invokeOnPartitions(SERVICE_NAME, factory, partitions);
   localMapStats.incrementPuts(size, System.currentTimeMillis() - time);
 }
Пример #2
0
 private Map<Integer, Object> retryPartitions(
     Collection<Integer> partitions, OperationFactory operationFactory) {
   try {
     return operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitions);
   } catch (Throwable t) {
     throw rethrow(t);
   }
 }
Пример #3
0
 public Map executeOnKeysInternal(Set<Data> keys, EntryProcessor entryProcessor) {
   // TODO: why are we not forwarding to executeOnKeysInternal(keys, entryProcessor, null) or some
   // other kind of fake
   // callback? now there is a lot of code duplication
   Map<Object, Object> result = new HashMap<Object, Object>();
   Collection<Integer> partitionsForKeys = getPartitionsForKeys(keys);
   try {
     OperationFactory operationFactory =
         operationProvider.createMultipleEntryOperationFactory(name, keys, entryProcessor);
     Map<Integer, Object> results =
         operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitionsForKeys);
     for (Object object : results.values()) {
       if (object != null) {
         MapEntries mapEntries = (MapEntries) object;
         mapEntries.putAllToMap(serializationService, result);
       }
     }
   } catch (Throwable t) {
     throw rethrow(t);
   }
   return result;
 }
Пример #4
0
 protected void getAllObjectInternal(List<Data> keys, List<Object> resultingKeyValuePairs) {
   if (keys == null || keys.isEmpty()) {
     return;
   }
   if (keys.isEmpty()) {
     return;
   }
   Collection<Integer> partitions = getPartitionsForKeys(keys);
   Map<Integer, Object> responses;
   try {
     OperationFactory operationFactory =
         operationProvider.createGetAllOperationFactory(name, keys);
     responses = operationService.invokeOnPartitions(SERVICE_NAME, operationFactory, partitions);
     for (Object response : responses.values()) {
       MapEntries entries = toObject(response);
       for (int i = 0; i < entries.size(); i++) {
         resultingKeyValuePairs.add(toObject(entries.getKey(i)));
         resultingKeyValuePairs.add(toObject(entries.getValue(i)));
       }
     }
   } catch (Exception e) {
     throw rethrow(e);
   }
 }