Ejemplo n.º 1
0
 private Object invokeData(CollectionOperation operation, Data dataKey) {
   final NodeEngine nodeEngine = getNodeEngine();
   try {
     int partitionId = nodeEngine.getPartitionService().getPartitionId(dataKey);
     Invocation inv =
         nodeEngine
             .getOperationService()
             .createInvocationBuilder(CollectionService.SERVICE_NAME, operation, partitionId)
             .build();
     Future f = inv.invoke();
     return nodeEngine.toObject(f.get());
   } catch (Throwable throwable) {
     throw ExceptionUtil.rethrow(throwable);
   }
 }
Ejemplo n.º 2
0
 private <T> T invoke(Operation operation, Data dataKey) {
   final NodeEngine nodeEngine = getNodeEngine();
   try {
     int partitionId = nodeEngine.getPartitionService().getPartitionId(dataKey);
     Invocation invocation =
         nodeEngine
             .getOperationService()
             .createInvocationBuilder(CollectionService.SERVICE_NAME, operation, partitionId)
             .build();
     Future f;
     Object o;
     if (config.isStatisticsEnabled()) {
       long time = System.currentTimeMillis();
       f = invocation.invoke();
       o = f.get();
       if (operation instanceof PutOperation) {
         getService()
             .getLocalMultiMapStatsImpl(proxyId)
             .incrementPuts(System.currentTimeMillis() - time);
       } else if (operation instanceof RemoveOperation
           || operation instanceof RemoveAllOperation) {
         getService()
             .getLocalMultiMapStatsImpl(proxyId)
             .incrementRemoves(System.currentTimeMillis() - time);
       } else if (operation instanceof GetAllOperation) {
         getService()
             .getLocalMultiMapStatsImpl(proxyId)
             .incrementGets(System.currentTimeMillis() - time);
       }
     } else {
       f = invocation.invoke();
       o = f.get();
     }
     return (T) nodeEngine.toObject(o);
   } catch (Throwable throwable) {
     throw ExceptionUtil.rethrow(throwable);
   }
 }