@Override public void flush() { // TODO: add a feature to mancenter to sync cache to db completely try { MapOperation mapFlushOperation = operationProvider.createMapFlushOperation(name); BinaryOperationFactory operationFactory = new BinaryOperationFactory(mapFlushOperation, getNodeEngine()); Map<Integer, Object> results = operationService.invokeOnAllPartitions(SERVICE_NAME, operationFactory); List<Future> futures = new ArrayList<Future>(); for (Entry<Integer, Object> entry : results.entrySet()) { Integer partitionId = entry.getKey(); Long count = ((Long) entry.getValue()); if (count != 0) { Operation operation = new AwaitMapFlushOperation(name, count); futures.add(operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId)); } } for (Future future : futures) { future.get(); } } catch (Throwable t) { throw rethrow(t); } }
@Override public void flush() { // TODO: add a feature to mancenter to sync cache to db completely try { MapOperation mapFlushOperation = operationProvider.createMapFlushOperation(name); BinaryOperationFactory operationFactory = new BinaryOperationFactory(mapFlushOperation, getNodeEngine()); Map<Integer, Object> results = operationService.invokeOnAllPartitions(SERVICE_NAME, operationFactory); List<Future> futures = new ArrayList<Future>(); for (Entry<Integer, Object> entry : results.entrySet()) { Integer partitionId = entry.getKey(); Long count = ((Long) entry.getValue()); if (count != 0) { Operation operation = new AwaitMapFlushOperation(name, count); futures.add(operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId)); } } for (Future future : futures) { future.get(); } } catch (Throwable t) { throw rethrow(t); } }
protected void evictAllInternal() { try { Operation operation = operationProvider.createEvictAllOperation(name); BinaryOperationFactory factory = new BinaryOperationFactory(operation, getNodeEngine()); Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory); int evictedCount = 0; for (Object object : resultMap.values()) { evictedCount += (Integer) object; } if (evictedCount > 0) { publishMapEvent(evictedCount, EntryEventType.EVICT_ALL); } } catch (Throwable t) { throw rethrow(t); } }
protected void evictAllInternal() { try { Operation operation = operationProvider.createEvictAllOperation(name); BinaryOperationFactory factory = new BinaryOperationFactory(operation, getNodeEngine()); Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory); int evictedCount = 0; for (Object object : resultMap.values()) { evictedCount += (Integer) object; } if (evictedCount > 0) { publishMapEvent(evictedCount, EntryEventType.EVICT_ALL); } } catch (Throwable t) { throw rethrow(t); } }
@Override public void addIndex(String attribute, boolean ordered) { validateIndexAttribute(attribute); try { AddIndexOperation addIndexOperation = new AddIndexOperation(name, attribute, ordered); operationService.invokeOnAllPartitions(SERVICE_NAME, new BinaryOperationFactory(addIndexOperation, getNodeEngine())); } catch (Throwable t) { throw rethrow(t); } }
public void clearInternal() { try { Operation clearOperation = operationProvider.createClearOperation(name); clearOperation.setServiceName(SERVICE_NAME); BinaryOperationFactory factory = new BinaryOperationFactory(clearOperation, getNodeEngine()); Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory); int clearedCount = 0; for (Object object : resultMap.values()) { clearedCount += (Integer) object; } if (clearedCount > 0) { publishMapEvent(clearedCount, CLEAR_ALL); } } catch (Throwable t) { throw rethrow(t); } }
@Override public void addIndex(String attribute, boolean ordered) { validateIndexAttribute(attribute); try { AddIndexOperation addIndexOperation = new AddIndexOperation(name, attribute, ordered); operationService.invokeOnAllPartitions(SERVICE_NAME, new BinaryOperationFactory(addIndexOperation, getNodeEngine())); } catch (Throwable t) { throw rethrow(t); } }
public void clearInternal() { try { Operation clearOperation = operationProvider.createClearOperation(name); clearOperation.setServiceName(SERVICE_NAME); BinaryOperationFactory factory = new BinaryOperationFactory(clearOperation, getNodeEngine()); Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory); int clearedCount = 0; for (Object object : resultMap.values()) { clearedCount += (Integer) object; } if (clearedCount > 0) { publishMapEvent(clearedCount, CLEAR_ALL); } if (statisticsEnabled) { LocalMapStatsProvider localMapStatsProvider = mapServiceContext.getLocalMapStatsProvider(); localMapStatsProvider.getLocalMapStatsImpl(name).incrementOtherOperations(); } } catch (Throwable t) { throw rethrow(t); } }
return new PartitionResponse(); case PARALLEL_OPERATION_FACTORY: return new BinaryOperationFactory(); case EVENT_ENVELOPE: return new EventEnvelope();
return new PartitionResponse(); case PARALLEL_OPERATION_FACTORY: return new BinaryOperationFactory(); case EVENT_ENVELOPE: return new EventEnvelope();